diff --git a/README.rst b/README.rst index 299e16c..7fd6a62 100644 --- a/README.rst +++ b/README.rst @@ -213,7 +213,7 @@ Actions with mailbox folders with MailBox('imap.mail.com').login('test@mail.com', 'pwd') as mailbox: # LIST for folder_info in mailbox.folder.list('INBOX'): - print(folder_info) # {'name': 'INBOX|cats', 'delim': '|', 'flags': '\\Unmarked \\HasChildren'} + print(folder_info) # {'name': 'INBOX|cats', 'delim': '|', 'flags': ('\\Unmarked', '\\HasChildren')} # SET mailbox.folder.set('INBOX') # GET diff --git a/imap_tools/folder.py b/imap_tools/folder.py index 01fe892..606d1e2 100644 --- a/imap_tools/folder.py +++ b/imap_tools/folder.py @@ -39,7 +39,7 @@ def exists(self, folder: str) -> bool: def create(self, folder: str or bytes): """ Create folder on the server. D - *Use email box delimitor to separate folders. Example for "|" delimitor: "folder|sub folder" + *Use email box delimiter to separate folders. Example for "|" delimiter: "folder|sub folder" """ result = self.mailbox.box._simple_command('CREATE', self._encode_folder(folder)) check_command_status('CREATE', result) @@ -96,9 +96,9 @@ def list(self, folder: str or bytes = '', search_args: str = '*', subscribed_onl % is similar to * but it does not match a hierarchy delimiter :param subscribed_only: bool - get only subscribed folders :return: [dict( - flags: str - folder flags, - delim: str - delimitor, name: str - folder name, + delim: str - delimiter, + flags: tuple(str) - folder flags, )] """ folder_item_re = re.compile(r'\((?P[\S ]*)\) "(?P[\S ]+)" (?P.+)') @@ -122,5 +122,6 @@ def list(self, folder: str or bytes = '', search_args: str = '*', subscribed_onl folder_dict['name'] = imap_utf7.decode(folder_item[1]) else: continue + folder_dict['flags'] = tuple(folder_dict['flags'].split()) # noqa result.append(folder_dict) return result diff --git a/imap_tools/mailbox.py b/imap_tools/mailbox.py index 6659662..dcf70a6 100644 --- a/imap_tools/mailbox.py +++ b/imap_tools/mailbox.py @@ -51,7 +51,7 @@ def fetch(self, criteria: str or bytes = 'ALL', charset: str = 'US-ASCII', limit :param miss_no_uid: miss emails without uid :param mark_seen: mark emails as seen on fetch :param reverse: in order from the larger date to the smaller - :param headers_only: get only email headers + :param headers_only: get only email headers (without text, html, attachments) :return generator: MailMessage """ search_result = self.box.search(charset, self._criteria_encoder(criteria, charset)) diff --git a/release_notes.rst b/release_notes.rst index db5559c..6a83b77 100644 --- a/release_notes.rst +++ b/release_notes.rst @@ -1,8 +1,8 @@ 0.16.0 ====== * added BaseMailBox.fetch headers_only argument - get only email headers -* BaseMailBox.attachments now returns inline/forwarded nameless attachments - +* BaseMailBox.attachments now can returns nameless attachments (inline/forwarded) +* MailBoxFolderManager.list result changed: item['flags'] now are tuple(str) 0.15.0 ====== diff --git a/tests/test_folders.py b/tests/test_folders.py index 1bac15d..70271d1 100644 --- a/tests/test_folders.py +++ b/tests/test_folders.py @@ -20,9 +20,11 @@ def test_folders(self): check_folder_set = {mailbox.folder_test_base, mailbox.folder_test_temp1, mailbox.folder_test_temp2} self.assertTrue(check_folder_set.issubset(set([i['name'] for i in folder_list]))) for folder in folder_list: - self.assertIs(type(folder['flags']), str) self.assertIs(type(folder['delim']), str) self.assertIs(type(folder['name']), str) + for flag in folder['flags']: + self.assertIs(type(flag), str) + # SET, GET mailbox.folder.set(mailbox.folder_test_base) self.assertEqual(mailbox.folder.get(), mailbox.folder_test_base)