Skip to content

Commit

Permalink
Fixed MailBox._fetch_in_bulk bug
Browse files Browse the repository at this point in the history
  • Loading branch information
ikvk committed Sep 29, 2020
1 parent 0c4e33c commit 395b74a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions docs/release_notes.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
0.24.0
======
* Added MailBox.__init__ starttls argument for using STARTTLS
* Fixed MailBox._fetch_in_bulk bug for empty self.search result

0.23.0
======
Expand Down
5 changes: 4 additions & 1 deletion imap_tools/mailbox.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,10 @@ def _fetch_by_one(self, message_nums: [str], message_parts: str) -> iter:
yield fetch_result[1]

def _fetch_in_bulk(self, message_nums: [str], message_parts: str) -> iter:
fetch_result = self.box.fetch(','.join(message_nums), message_parts)
message_nums_str = ','.join(message_nums)
if not message_nums_str:
raise StopIteration()
fetch_result = self.box.fetch(message_nums_str, message_parts)
check_command_status(fetch_result, MailboxFetchError)
for built_fetch_item in grouper(fetch_result[1], 2):
yield built_fetch_item
Expand Down

0 comments on commit 395b74a

Please sign in to comment.