summaryrefslogtreecommitdiff
path: root/alot
diff options
context:
space:
mode:
authorDylan Baker <dylan@pnwbakers.com>2017-07-24 16:43:14 -0700
committerDylan Baker <dylan@pnwbakers.com>2017-07-24 16:43:14 -0700
commit188c7b48467f71d4fe508569a0a16f2b88d9055d (patch)
tree4e4af60025c05b6f7f1e639c0bd3ed4f86ce3872 /alot
parent55f7d0dbf14c63754b61c5986e857f1f30bf1ba9 (diff)
db/utils: optimize if statements
1) dont use len() to test that a list is non-empty 2) only go down the else clause if it's possible to have a valid signature.
Diffstat (limited to 'alot')
-rw-r--r--alot/db/utils.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/alot/db/utils.py b/alot/db/utils.py
index 06cb021e..29940fd9 100644
--- a/alot/db/utils.py
+++ b/alot/db/utils.py
@@ -44,9 +44,9 @@ def add_signature_headers(mail, sigs, error_msg):
if isinstance(error_msg, str):
error_msg = error_msg.decode('utf-8')
- if len(sigs) == 0:
+ if not sigs:
error_msg = error_msg or u'no signature found'
- else:
+ elif not error_msg:
try:
key = crypto.get_key(sigs[0].fpr)
for uid in key.uids: