summaryrefslogtreecommitdiff
path: root/alot/db/manager.py
diff options
context:
space:
mode:
authorBen Finney <ben+python@benfinney.id.au>2018-04-23 16:16:27 +1000
committerBen Finney <ben@benfinney.id.au>2018-04-23 19:23:21 +1000
commit6f36401bcaecc6583514e5530138a54f46f036c6 (patch)
tree72eaf543a82968d107c34bb838c949cb11a2f6d7 /alot/db/manager.py
parent2404bc62530c9c2715fb3b9d33a60f27b5a790ae (diff)
Extract a level of nested conditionals for tag command.
Diffstat (limited to 'alot/db/manager.py')
-rw-r--r--alot/db/manager.py11
1 files changed, 5 insertions, 6 deletions
diff --git a/alot/db/manager.py b/alot/db/manager.py
index cbde9c88..057c72d0 100644
--- a/alot/db/manager.py
+++ b/alot/db/manager.py
@@ -160,15 +160,14 @@ class DBManager(object):
for msg in query.search_messages():
msg.freeze()
if cmd == 'tag':
- for tag in tags:
- msg.add_tag(tag, sync_maildir_flags=sync)
+ strategy = msg.add_tag
if cmd == 'set':
msg.remove_all_tags()
- for tag in tags:
- msg.add_tag(tag, sync_maildir_flags=sync)
+ strategy = msg.add_tag
elif cmd == 'untag':
- for tag in tags:
- msg.remove_tag(tag, sync_maildir_flags=sync)
+ strategy = msg.remove_tag
+ for tag in tags:
+ strategy(tag, sync_maildir_flags=sync)
msg.thaw()
logging.debug('ended atomic')