summaryrefslogtreecommitdiff
path: root/src/leap/mail
diff options
context:
space:
mode:
authorBruno Wagner <bwagner@riseup.net>2015-11-04 12:10:56 -0200
committerBruno Wagner <bwagner@riseup.net>2015-12-10 15:38:41 -0200
commit71cf1c4a243181330c0e973b8f69f9143b3d18de (patch)
tree57478676b0b93ef46bb2779f809328110a578412 /src/leap/mail
parent569449e633abbe22b63b9c6b8c680119a3bdceda (diff)
Fixed the get_body logic
It won't break anymore if the body is None, but will return an empty body in that case
Diffstat (limited to 'src/leap/mail')
-rw-r--r--src/leap/mail/adaptors/soledad.py15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/leap/mail/adaptors/soledad.py b/src/leap/mail/adaptors/soledad.py
index 8de83f7..7f2b1cf 100644
--- a/src/leap/mail/adaptors/soledad.py
+++ b/src/leap/mail/adaptors/soledad.py
@@ -687,13 +687,14 @@ class MessageWrapper(object):
:rtype: deferred
"""
body_phash = self.hdoc.body
- if not body_phash:
- if self.cdocs:
- return self.cdocs[1]
- d = store.get_doc('C-' + body_phash)
- d.addCallback(lambda doc: ContentDocWrapper(**doc.content))
- return d
-
+ if body_phash:
+ d = store.get_doc('C-' + body_phash)
+ d.addCallback(lambda doc: ContentDocWrapper(**doc.content))
+ return d
+ elif self.cdocs:
+ return self.cdocs[1]
+ else:
+ return ''
#
# Mailboxes