summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKali Kaneko <kali@leap.se>2015-07-10 12:47:21 -0400
committerRuben Pollan <meskio@sindominio.net>2015-07-13 11:55:30 -0400
commit1b04096571cfa9002f9bd1cb75d99cdbbb7d7936 (patch)
tree4db3ce9b4852c29c0f7731713eb534603ec41ae6
parent4ab5660b5c3a2fc29f2d08d06e1958fc91ee5af7 (diff)
[bug] fix keyerror when inserting msg on pending_inserts dict
The decission to index the pending_inserts dict by message-id is a bit brittle. I assume any well-formed message in the RealWorld (tm) will have this header, but many samples used in the tests will break this assumption.
-rw-r--r--src/leap/mail/mail.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/leap/mail/mail.py b/src/leap/mail/mail.py
index 772b6db..feed11b 100644
--- a/src/leap/mail/mail.py
+++ b/src/leap/mail/mail.py
@@ -638,8 +638,9 @@ class MessageCollection(object):
notify_just_mdoc = False
if notify_just_mdoc:
- msgid = headers['message-id']
- self._pending_inserts[msgid] = defer.Deferred()
+ msgid = headers.get('message-id')
+ if msgid:
+ self._pending_inserts[msgid] = defer.Deferred()
if not self.is_mailbox_collection():
raise NotImplementedError()