diff options
Diffstat (limited to 'alot/db/envelope.py')
-rw-r--r-- | alot/db/envelope.py | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/alot/db/envelope.py b/alot/db/envelope.py index 0a6d4f58..3dc12278 100644 --- a/alot/db/envelope.py +++ b/alot/db/envelope.py @@ -13,8 +13,7 @@ from email.mime.text import MIMEText from email.mime.multipart import MIMEMultipart from email.mime.application import MIMEApplication import email.charset as charset - -import gpgme +import gpg from .attachment import Attachment from .utils import encode_header @@ -197,8 +196,8 @@ class Envelope(object): raise GPGProblem("Could not sign message (GPGME " "did not return a signature)", code=GPGCode.KEY_CANNOT_SIGN) - except gpgme.GpgmeError as e: - if e.code == gpgme.ERR_BAD_PASSPHRASE: + except gpg.errors.GPGMEError as e: + if e.getcode() == gpg.errors.BAD_PASSPHRASE: # 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() == '': @@ -237,7 +236,7 @@ class Envelope(object): try: encrypted_str = crypto.encrypt(plaintext, self.encrypt_keys.values()) - except gpgme.GpgmeError as e: + except gpg.errors.GPGMEError as e: raise GPGProblem(str(e), code=GPGCode.KEY_CANNOT_ENCRYPT) outer_msg = MIMEMultipart('encrypted', |