Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
T
topydo
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
topydo
Commits
64eb927f
Commit
64eb927f
authored
Jan 03, 2020
by
Kirill Smelkov
1
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
X Draft support for OR in filters
parent
b060ea9e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
1 deletion
+16
-1
topydo/lib/Filter.py
topydo/lib/Filter.py
+16
-1
No files found.
topydo/lib/Filter.py
View file @
64eb927f
...
...
@@ -382,7 +382,18 @@ def get_filter_list(p_expression):
The filter expression is a list of strings.
"""
result = []
or_ = False # was previous word '||'
for arg in p_expression:
# XXX draft support for OR filters
# TODO tests
# TODO add support for {...} https://support.google.com/mail/answer/7190
if arg.lower() in ('||', 'or'):
# XXX error if it already was || previously
# XXX error if there was not previous filter
or_ = True
continue
# when a word starts with -, it should be negated
is_negated = len(arg) > 1 and arg[0] == '-'
arg = arg[1:] if is_negated else arg
...
...
@@ -399,6 +410,10 @@ def get_filter_list(p_expression):
if is_negated:
argfilter = NegationFilter(argfilter)
result.append(argfilter)
if or_:
result[-1] = OrFilter(result[-1], argfilter)
or_ = False
else:
result.append(argfilter)
return result
Kirill Smelkov
@kirr
·
Jan 03, 2020
Maintainer
.
.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment