summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDylan Baker <dylan@pnwbakers.com>2017-09-06 10:57:45 -0700
committerDylan Baker <dylan@pnwbakers.com>2017-09-06 14:30:13 -0700
commit7ce3f07f677372e958995e858a3365af918694f1 (patch)
treecfb60c7521d20dd8604e6f86501e8fe24d786a68
parentd4ea14c7f58e2a7c1981f15aec513517d9268918 (diff)
db/message: Try to use the 'Sender' header if the 'From' header is null
This makes drafts display correctly.
-rw-r--r--alot/db/message.py2
-rw-r--r--tests/db/message_test.py1
2 files changed, 2 insertions, 1 deletions
diff --git a/alot/db/message.py b/alot/db/message.py
index 72d87f12..731b4e1f 100644
--- a/alot/db/message.py
+++ b/alot/db/message.py
@@ -51,6 +51,8 @@ class Message(object):
try:
sender = decode_header(msg.get_header('From'))
+ if not sender:
+ sender = decode_header(msg.get_header('Sender'))
except NullPointerError:
sender = None
if sender:
diff --git a/tests/db/message_test.py b/tests/db/message_test.py
index a50d943e..4aa88223 100644
--- a/tests/db/message_test.py
+++ b/tests/db/message_test.py
@@ -78,7 +78,6 @@ class TestMessage(unittest.TestCase):
MockNotmuchMessage({'From': '"User Name" <user@example.com>'}))
self.assertEqual(msg.get_author(), ('User Name', 'user@example.com'))
- @unittest.expectedFailure
def test_get_author_sender(self):
"""Message._from is populated using the 'Sender' header when no 'From'
header is present.