diff options
author | Kali Kaneko <kali@leap.se> | 2014-02-02 09:26:37 -0400 |
---|---|---|
committer | Kali Kaneko <kali@leap.se> | 2014-02-02 18:08:31 -0400 |
commit | 18fed49c4143eb764ae9e806882d24f8f4e95744 (patch) | |
tree | 2c0c56a28ac9bf4839623b28de746670e6e4b499 /src/leap/mail/imap/messageparts.py | |
parent | 3a8fda3aa4645adbba228e7d2f204bfe6d400321 (diff) |
fix missing content after in-memory add
because THE KEYS WILL BE STRINGS AFTER ADDED TO SOLEDAD
Can I remember that?
* Fix copy from local folders
* Fix copy when we already have a copy of the message in the inbox,
marked as deleted.
* Fix also bad deferred.succeed in add_msg when it already exist.
Diffstat (limited to 'src/leap/mail/imap/messageparts.py')
-rw-r--r-- | src/leap/mail/imap/messageparts.py | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/leap/mail/imap/messageparts.py b/src/leap/mail/imap/messageparts.py index 5067263..b07681b 100644 --- a/src/leap/mail/imap/messageparts.py +++ b/src/leap/mail/imap/messageparts.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # messageparts.py # Copyright (C) 2014 LEAP # @@ -315,6 +314,7 @@ class MessageWrapper(object): fdoc, hdoc, cdocs = map( lambda part: msg_dict.get(part, None), [self.FDOC, self.HDOC, self.CDOCS]) + for t, doc in ((self.FDOC, fdoc), (self.HDOC, hdoc), (self.CDOCS, cdocs)): self._dict[t] = ReferenciableDict(doc) if doc else None @@ -390,8 +390,10 @@ class MessagePart(object): first_part = pmap.get('1', None) if not empty(first_part): phash = first_part['phash'] + else: + phash = None - if not phash: + if phash is None: logger.warning("Could not find phash for this subpart!") payload = "" else: @@ -435,11 +437,13 @@ class MessagePart(object): fields.TYPE_CONTENT_VAL, str(phash)) cdoc = first(cdocs) - if not cdoc: + if cdoc is None: logger.warning( "Could not find the content doc " "for phash %s" % (phash,)) - payload = cdoc.content.get(fields.RAW_KEY, "") + payload = "" + else: + payload = cdoc.content.get(fields.RAW_KEY, "") return payload # TODO should memory-bound this memoize!!! |