summaryrefslogtreecommitdiff
path: root/alot
diff options
context:
space:
mode:
authorDylan Baker <dylan@pnwbakers.com>2018-03-06 16:28:24 -0800
committerDylan Baker <dylan@pnwbakers.com>2018-03-06 16:41:51 -0800
commit9c0cc34b683b5caa01e0f94865df88577694e820 (patch)
treeaa685e5c20c98d2f1f7435237792ee288bb0cbba /alot
parent858c7bca401565b63851d78a8591cdac80480080 (diff)
utils: Fix types for add_signature_header
currently _handle_signatures will pass `False~ for the error_msg if there is no error, but the documentation for add_signature_headers says it only accepts strings. Don't do either of these, instead use None if there is no error, otherwise a string, and updated the assert and documentation to match.
Diffstat (limited to 'alot')
-rw-r--r--alot/db/utils.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/alot/db/utils.py b/alot/db/utils.py
index 20665a03..35652601 100644
--- a/alot/db/utils.py
+++ b/alot/db/utils.py
@@ -41,14 +41,14 @@ def add_signature_headers(mail, sigs, error_msg):
:param mail: :class:`email.message.Message` the message to entitle
:param sigs: list of :class:`gpg.results.Signature`
- :param error_msg: `str` containing an error message, the empty
- string indicating no error
+ :param error_msg: An error message if there is one, or None
+ :type error_msg: :class:`str` or `None`
'''
sig_from = ''
sig_known = True
uid_trusted = False
- assert isinstance(error_msg, (str, bool))
+ assert error_msg is None or isinstance(error_msg, str)
if not sigs:
error_msg = error_msg or u'no signature found'
@@ -111,7 +111,7 @@ def _handle_signatures(original, message, params):
:param params: the message parameters as returned by :func:`get_params`
:type params: dict[str, str]
"""
- malformed = False
+ malformed = None
if len(message.get_payload()) != 2:
malformed = u'expected exactly two messages, got {0}'.format(
len(message.get_payload()))