diff options
author | Johannes Löthberg <johannes@kyriasis.com> | 2017-06-02 20:28:57 +0200 |
---|---|---|
committer | Johannes Löthberg <johannes@kyriasis.com> | 2017-06-08 13:26:00 +0200 |
commit | ba84186f82833b4f5eab2015931e1b05651a48f1 (patch) | |
tree | ce2e20c1aea72ebccea24a67d5c22cb77e8334a9 /alot/db/manager.py | |
parent | 3b935dff34da6bfed4d8643946a86086bdb78cba (diff) |
Exclude search.exclude_tags from searches
Fixes #707 and #332.
Signed-off-by: Johannes Löthberg <johannes@kyriasis.com>
Diffstat (limited to 'alot/db/manager.py')
-rw-r--r-- | alot/db/manager.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/alot/db/manager.py b/alot/db/manager.py index 6bbaca2f..cd0c5073 100644 --- a/alot/db/manager.py +++ b/alot/db/manager.py @@ -368,7 +368,7 @@ class DBManager(object): sender.close() return receiver, process - def get_threads(self, querystring, sort='newest_first'): + def get_threads(self, querystring, sort='newest_first', exclude_tags=None): """ asynchronously look up thread ids matching `querystring`. @@ -377,6 +377,8 @@ class DBManager(object): :param sort: Sort order. one of ['oldest_first', 'newest_first', 'message_id', 'unsorted'] :type query: str + :param exclude_tags: Tags to exclude by default unless included in the search + :type exclude_tags: list of str :returns: a pipe together with the process that asynchronously writes to it. :rtype: (:class:`multiprocessing.Pipe`, @@ -385,6 +387,9 @@ class DBManager(object): assert sort in self._sort_orders q = self.query(querystring) q.set_sort(self._sort_orders[sort]) + if exclude_tags: + for tag in exclude_tags: + q.exclude_tag(tag) return self.async(q.search_threads, (lambda a: a.get_thread_id())) def query(self, querystring): |