1
0
Fork 0

Prevent ImapTransport from raising exception when no messages are available. Fixes #24. Release 3.4.1.

This commit is contained in:
Adam Coddington 2014-08-14 21:38:52 -07:00
parent 3ffbcea3bf
commit 7474cf0118
2 changed files with 8 additions and 2 deletions

View file

@ -36,7 +36,13 @@ class ImapTransport(EmailTransport):
def _get_all_message_ids(self):
# Fetch all the message uids
response, message_ids = self.server.uid('search', None, 'ALL')
return message_ids[0].split(' ')
message_id_string = message_ids[0].strip()
# Usually `message_id_string` will be a list of space-separated
# ids; we must make sure that it isn't an empty string before
# splitting into individual UIDs.
if message_id_string:
return message_id_string.split(' ')
return []
def _get_small_message_ids(self, message_ids):
# Using existing message uids, get the sizes and

View file

@ -11,7 +11,7 @@ gmail_oauth2_require = [
setup(
name='django-mailbox',
version='3.4',
version='3.4.1',
url='http://github.com/coddingtonbear/django-mailbox/',
description=(
'Import mail from POP3, IMAP, local mailboxes or directly from '