diff options
author | Lucas Hoffmann <l-m-h@web.de> | 2016-03-12 19:41:24 +0100 |
---|---|---|
committer | Patrick Totzke <patricktotzke@gmail.com> | 2016-03-24 21:01:43 +0000 |
commit | a51f7392e353a11dd8aeba53618731c63737848a (patch) | |
tree | 7a37fafe4141488823a13be21b113b1a66355850 /alot/account.py | |
parent | bb4bce29c506da51142fbf3df4b06192f293e054 (diff) |
Handle deprecated option values gracefully.
Diffstat (limited to 'alot/account.py')
-rw-r--r-- | alot/account.py | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/alot/account.py b/alot/account.py index bb350f99..017fa31e 100644 --- a/alot/account.py +++ b/alot/account.py @@ -65,16 +65,23 @@ class Account(object): self.signature_filename = signature_filename self.signature_as_attachment = signature_as_attachment self.sign_by_default = sign_by_default - self.encrypt_by_default = encrypt_by_default self.sent_box = sent_box self.sent_tags = sent_tags self.draft_box = draft_box self.draft_tags = draft_tags self.abook = abook - if self.encrypt_by_default == u"True" or \ - self.encrypt_by_default == u"False": - logging.debug("Deprecation warning: The format for the " - "encrypt_by_default option changed.") + # Handle encrypt_by_default in an backwards compatible way. The + # logging info call can later be upgraded to warning or error. + encrypt_by_default = encrypt_by_default.lower() + msg = "Deprecation warning: The format for the encrypt_by_default " \ + "option changed. Please use 'none', 'all' or 'trusted'." + if encrypt_by_default in (u"true", u"yes", u"1"): + encrypt_by_default = u"all" + logging.info(msg) + elif encrypt_by_default in (u"false", u"no", u"0"): + encrypt_by_default = u"none" + logging.info(msg) + self.encrypt_by_default = encrypt_by_default def get_addresses(self): """return all email addresses connected to this account, in order of |