diff options
author | Victor Shyba <victor.shyba@gmail.com> | 2015-07-29 16:39:30 -0300 |
---|---|---|
committer | Folker Bernitt <fbernitt@thoughtworks.com> | 2015-08-11 17:00:30 +0200 |
commit | 8c03db8847c79e4b5f9e98048ef6f3371cae8c71 (patch) | |
tree | d6dc21faf0d3193f2e0117bfcb9868b5ce8d9f9c /service | |
parent | defc4b65572c64d24b2be1db7ba887d3356ecd11 (diff) |
mailbox collision shouldnt cancel operation
Diffstat (limited to 'service')
-rw-r--r-- | service/pixelated/adapter/services/mailboxes.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/service/pixelated/adapter/services/mailboxes.py b/service/pixelated/adapter/services/mailboxes.py index 3662bbe9..80cc74fe 100644 --- a/service/pixelated/adapter/services/mailboxes.py +++ b/service/pixelated/adapter/services/mailboxes.py @@ -17,6 +17,7 @@ from twisted.internet import defer from pixelated.adapter.services.mailbox import Mailbox from pixelated.adapter.listeners.mailbox_indexer_listener import MailboxIndexerListener from pixelated.adapter.model.mail import welcome_mail +from twisted.mail.imap4 import MailboxCollision class Mailboxes(object): @@ -43,7 +44,11 @@ class Mailboxes(object): mailbox_name = mailbox_name.upper() # if mailbox_name not in self.account.mailboxes: if mailbox_name not in (yield self.account.account.list_all_mailbox_names()): - yield self.account.addMailbox(mailbox_name) + try: + yield self.account.addMailbox(mailbox_name) + except MailboxCollision: + pass + # It means that it is already created. FIXME Why list_all fails to tell? yield MailboxIndexerListener.listen(self.account, mailbox_name, self.querier) defer.returnValue(Mailbox.create(mailbox_name, self.querier, self.search_engine)) |