summaryrefslogtreecommitdiff
path: root/src/leap/mail/utils.py
diff options
context:
space:
mode:
authorKali Kaneko <kali@leap.se>2015-03-26 15:59:33 -0400
committerKali Kaneko <kali@leap.se>2015-03-30 14:48:14 -0400
commit8e916eeadfcd76d50b54a2621d789e6a296dcce6 (patch)
tree7bb82a2ff750c5dd830201a2aa730e29eabf7168 /src/leap/mail/utils.py
parentd11c03d1126f1744789d107b0f9bd04fc8a2f50b (diff)
[bug] fix early append notification
There's a workaround for "slow" APPENDS to an inbox, and it is that we have a flag to allow returning early when JUST the mdoc (the meta-document) has been written. However, this was givin a problem when doing a FETCH right after an APPEND (with notify_just_mdoc=True) has been done. This commit fixes it by making the FETCH command first check if there's an ongoing pending write, and queueing itself right after the write queue has been completed. This fixes the testFullAppend regression. Releases: 0.4.0
Diffstat (limited to 'src/leap/mail/utils.py')
-rw-r--r--src/leap/mail/utils.py21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/leap/mail/utils.py b/src/leap/mail/utils.py
index 8e51024..029e9f5 100644
--- a/src/leap/mail/utils.py
+++ b/src/leap/mail/utils.py
@@ -351,3 +351,24 @@ def json_loads(data):
obj = json.loads(data, cls=json.JSONDecoder)
return obj
+
+
+class CaseInsensitiveDict(dict):
+ """
+ A dictionary subclass that will allow case-insenstive key lookups.
+ """
+ def __init__(self, d=None):
+ if d is None:
+ d = []
+ if isinstance(d, dict):
+ for key, value in d.items():
+ self[key] = value
+ else:
+ for key, value in d:
+ self[key] = value
+
+ def __setitem__(self, key, value):
+ super(CaseInsensitiveDict, self).__setitem__(key.lower(), value)
+
+ def __getitem__(self, key):
+ return super(CaseInsensitiveDict, self).__getitem__(key.lower())