summaryrefslogtreecommitdiff
path: root/service
diff options
context:
space:
mode:
authorVictor Shyba <victor.shyba@gmail.com>2015-07-20 17:13:49 +0200
committerFolker Bernitt <fbernitt@thoughtworks.com>2015-08-11 17:00:25 +0200
commit3d534a500ca8ac015788e7958cca63f36ae351f2 (patch)
tree2afe1b1aaa8bb31df7168a25246bf8750bc84f56 /service
parent02c3a0fb34701cf9ee37fdfaf25a8e85ff327396 (diff)
yields and small changes to make incoming mail fetching work
Diffstat (limited to 'service')
-rw-r--r--service/pixelated/adapter/model/mail.py4
-rw-r--r--service/pixelated/adapter/services/mailboxes.py4
-rw-r--r--service/pixelated/adapter/soledad/soledad_facade_mixin.py4
3 files changed, 8 insertions, 4 deletions
diff --git a/service/pixelated/adapter/model/mail.py b/service/pixelated/adapter/model/mail.py
index 3cf97111..96ed0467 100644
--- a/service/pixelated/adapter/model/mail.py
+++ b/service/pixelated/adapter/model/mail.py
@@ -75,7 +75,7 @@ class Mail(object):
@property
def mailbox_name(self):
# FIXME mbox is no longer available, instead we now have mbox_uuid
- return self.fdoc.content.get('mbox')
+ return self.fdoc.content.get('mbox', '')
@property
def _mime_multipart(self):
@@ -398,7 +398,7 @@ class PixelatedMail(Mail):
@property
def mailbox_name(self):
# FIXME mbox is no longer available, instead we now have mbox_uuid
- return self.fdoc.content.get('mbox')
+ return self.fdoc.content.get('mbox', '')
@property
def is_recent(self):
diff --git a/service/pixelated/adapter/services/mailboxes.py b/service/pixelated/adapter/services/mailboxes.py
index d458406b..45dd9192 100644
--- a/service/pixelated/adapter/services/mailboxes.py
+++ b/service/pixelated/adapter/services/mailboxes.py
@@ -63,8 +63,10 @@ class Mailboxes(object):
def sent(self):
return self._create_or_get('SENT')
+ @defer.inlineCallbacks
def mailboxes(self):
- return [self._create_or_get(leap_mailbox_name) for leap_mailbox_name in self.account.mailboxes]
+ mailboxes_names = yield self.account.account.list_all_mailbox_names()
+ defer.returnValue([(yield self._create_or_get(leap_mailbox_name)) for leap_mailbox_name in mailboxes_names])
def move_to_trash(self, mail_id):
return self._move_to(mail_id, self.trash)
diff --git a/service/pixelated/adapter/soledad/soledad_facade_mixin.py b/service/pixelated/adapter/soledad/soledad_facade_mixin.py
index 0683a5bc..bc12e8ff 100644
--- a/service/pixelated/adapter/soledad/soledad_facade_mixin.py
+++ b/service/pixelated/adapter/soledad/soledad_facade_mixin.py
@@ -65,8 +65,10 @@ class SoledadDbFacadeMixin(object):
def delete_doc(self, doc):
return self.soledad.delete_doc(doc)
+ @defer.inlineCallbacks
def idents_by_mailbox(self, mbox):
- return set(doc.content['chash'] for doc in self.soledad.get_from_index('by-type-and-mbox-and-deleted', 'flags', mbox, '0')) if mbox else set()
+ mbox_docs = (yield self.soledad.get_from_index('by-type-and-mbox-and-deleted', 'flags', mbox, '0')) if mbox else []
+ defer.returnValue(set(doc.content['chash'] for doc in mbox_docs))
def get_all_mbox(self):
return self.soledad.get_from_index('by-type', 'mbox')