summaryrefslogtreecommitdiff
path: root/mail
diff options
context:
space:
mode:
authorKali Kaneko <kali@leap.se>2015-06-29 09:53:36 -0400
committerKali Kaneko <kali@leap.se>2015-06-29 09:53:36 -0400
commit44f7fa958ccbc7173a70951700dae96354785d1a (patch)
treef5ef10b09329227901efd40968606c42e908356e /mail
parentd50b7c95cdfe709ae584caf8c726ddefb2514411 (diff)
[bug] avoid KeyError on pending_insert_docs lookup
in a previous commit, there was a bug inserted in which a key lookup was being made unconditionally, even when the pending_insert_docs was None. Releases: 0.4.0
Diffstat (limited to 'mail')
-rw-r--r--mail/src/leap/mail/adaptors/soledad.py19
1 files changed, 10 insertions, 9 deletions
diff --git a/mail/src/leap/mail/adaptors/soledad.py b/mail/src/leap/mail/adaptors/soledad.py
index 0565877f..4020bd06 100644
--- a/mail/src/leap/mail/adaptors/soledad.py
+++ b/mail/src/leap/mail/adaptors/soledad.py
@@ -150,7 +150,7 @@ class SoledadDocumentWrapper(models.DocumentWrapper):
d.addCallback(update_doc_id)
if is_copy:
- d.addErrback(update_wrapper),
+ d.addErrback(update_wrapper)
else:
d.addErrback(self._catch_revision_conflict, self.future_doc_id)
return d
@@ -507,7 +507,7 @@ class MessageWrapper(object):
for doc_id, cdoc in zip(self.mdoc.cdocs, self.cdocs.values()):
cdoc.set_future_doc_id(doc_id)
- def create(self, store, notify_just_mdoc=False, pending_inserts_dict=None):
+ def create(self, store, notify_just_mdoc=False, pending_inserts_dict={}):
"""
Create all the parts for this message in the store.
@@ -547,13 +547,14 @@ class MessageWrapper(object):
"Cannot create: fdoc has a doc_id")
def unblock_pending_insert(result):
- ci_headers = lowerdict(self.hdoc.headers)
- msgid = ci_headers.get('message-id', None)
- try:
- d = pending_inserts_dict[msgid]
- d.callback(msgid)
- except KeyError:
- pass
+ if pending_inserts_dict:
+ ci_headers = lowerdict(self.hdoc.headers)
+ msgid = ci_headers.get('message-id', None)
+ try:
+ d = pending_inserts_dict[msgid]
+ d.callback(msgid)
+ except KeyError:
+ pass
return result
# TODO check that the doc_ids in the mdoc are coherent