Skip to content

Commit 126f89f

Browse files
committed
BaseFilter: allow to remove non-existent tags
With notmuch2 bindings, removing a non-existing tag raises a KeryError. Catch that to allow the same filter usage as with legacy bindings. Suggested-By: Toke Høiland-Jørgensen <[email protected]>
1 parent fa88018 commit 126f89f

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

afew/filters/BaseFilter.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,9 @@ def commit(self, dry_run=True):
102102
message.tags.add(tag)
103103

104104
for tag in self._remove_tags.get(message_id, []):
105-
message.tags.remove(tag)
105+
try:
106+
message.tags.remove(tag)
107+
except KeyError:
108+
pass
106109

107110
self.flush_changes()

0 commit comments

Comments
 (0)