summaryrefslogtreecommitdiff
path: root/alot/account.py
diff options
context:
space:
mode:
authorLucas Hoffmann <l-m-h@web.de>2016-03-12 19:41:24 +0100
committerPatrick Totzke <patricktotzke@gmail.com>2016-03-24 21:01:43 +0000
commita51f7392e353a11dd8aeba53618731c63737848a (patch)
tree7a37fafe4141488823a13be21b113b1a66355850 /alot/account.py
parentbb4bce29c506da51142fbf3df4b06192f293e054 (diff)
Handle deprecated option values gracefully.
Diffstat (limited to 'alot/account.py')
-rw-r--r--alot/account.py17
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