summaryrefslogtreecommitdiff
path: root/alot
diff options
context:
space:
mode:
authorMichael Stapelberg <michael@stapelberg.de>2012-05-04 17:17:03 +0200
committerMichael Stapelberg <michael@stapelberg.de>2012-05-04 17:17:03 +0200
commit5c2895f1323f68fb9492636dc54e1ae4f332d6fc (patch)
treebe6a7b37e358d4bb3a6a310f9986d8e648266283 /alot
parent453c9a1164549a2d21812edec50bd8a6e0764bb2 (diff)
properly check for GPG_AGENT_INFO (handle unset and empty)
Diffstat (limited to 'alot')
-rw-r--r--alot/db/envelope.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/alot/db/envelope.py b/alot/db/envelope.py
index 2d54646d..61d8d19d 100644
--- a/alot/db/envelope.py
+++ b/alot/db/envelope.py
@@ -171,7 +171,9 @@ class Envelope(object):
except pyme.errors.GPGMEError as e:
# 11 == GPG_ERR_BAD_PASSPHRASE
if e.getcode() == 11:
- if not os.environ.has_key('GPG_AGENT_INFO'):
+ # If GPG_AGENT_INFO is unset or empty, the user just does
+ # not have gpg-agent running (properly).
+ if os.environ.get('GPG_AGENT_INFO', '').strip() == '':
raise ConstructMailError(("Bad passphrase and "
"GPG_AGENT_INFO not set. Please setup "
"gpg-agent."))