From 8ab0f708c5ee7856511823a6a1aab14cb99307cb Mon Sep 17 00:00:00 2001 From: ashvetsov Date: Thu, 11 Apr 2013 15:48:49 +0400 Subject: [PATCH] Fixed issue with exception when IMAP transport returned no messages. --HG-- branch : ashvetsov/fixes-to-push extra : source : b9b283ff46d734933c4a715630e114d5e250a34b --- django_mailbox/transports/imap.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/django_mailbox/transports/imap.py b/django_mailbox/transports/imap.py index 1c57b1c..9872129 100644 --- a/django_mailbox/transports/imap.py +++ b/django_mailbox/transports/imap.py @@ -21,6 +21,10 @@ class ImapTransport(object): def get_message(self): typ, inbox = self.server.search(None, 'ALL') + + if not inbox[0]: + return + for key in inbox[0].split(): try: typ, msg_contents = self.server.fetch(key, '(RFC822)')