diff options
author | Duda Dornelles <ddornell@thoughtworks.com> | 2014-09-16 17:32:04 -0300 |
---|---|---|
committer | Duda Dornelles <ddornell@thoughtworks.com> | 2014-09-16 17:32:04 -0300 |
commit | 82549ba231b21f9bc374d8aa104166506cc96f8f (patch) | |
tree | 4a8ceb2609d60982811d928ecf4997dfeaf0c2c7 | |
parent | eb9af89a56da8f6d4afe759c8b88eaef5d181b8e (diff) |
should use create_or_get to get mailboxes
-rw-r--r-- | service/pixelated/adapter/pixelated_mailboxes.py | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/service/pixelated/adapter/pixelated_mailboxes.py b/service/pixelated/adapter/pixelated_mailboxes.py index 4866dbe4..8a01f26f 100644 --- a/service/pixelated/adapter/pixelated_mailboxes.py +++ b/service/pixelated/adapter/pixelated_mailboxes.py @@ -3,6 +3,8 @@ from pixelated.adapter.pixelated_mailbox import PixelatedMailbox class PixelatedMailBoxes(): + + def __init__(self, account): self.account = account @@ -14,6 +16,9 @@ class PixelatedMailBoxes(): def drafts(self): return self._create_or_get('DRAFTS') + def trash(self): + return self._create_or_get('TRASH') + @property def mailboxes(self): return [PixelatedMailbox.create(self.account, leap_mailbox_name) for leap_mailbox_name in @@ -41,7 +46,4 @@ class PixelatedMailBoxes(): def mailbox_exists(self, name): return name.upper() in map(lambda x: x.upper(), self.account.mailboxes) - def trash(self): - if not self.mailbox_exists('TRASH'): - self.account.addMailbox('TRASH') - return PixelatedMailbox.create(self.account, 'TRASH') + |