From 1b04096571cfa9002f9bd1cb75d99cdbbb7d7936 Mon Sep 17 00:00:00 2001 From: Kali Kaneko Date: Fri, 10 Jul 2015 12:47:21 -0400 Subject: [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. --- src/leap/mail/mail.py | 5 +++-- 1 file 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() -- cgit v1.2.3