X-GM-RAW search extension. Thanks to John Louis del Rosario for the
patch.
+ENVELOPE FETCH response parsing [NEW, API CHANGE]
+-------------------------------------------------
+ENVELOPE FETCH responses are now returned as Envelope instances. These
+objects are namedtuples providing convenient attribute and positional
+based access to envelope fields. The Date field is also now converted
+to a datetime instance.
+
+As part of this change various date and time related utilities were
+moved to a new module at imapclient.datetime_util.
+
SELECT response bug fix
-----------------------
-Handle square brackets in flags returned in SELECT
-response. Previously these would cause parsing errors. Thanks to
-Benjamin Morrise for the bug report.
+Handle square brackets in flags returned in SELECT response.
+Previously these would cause parsing errors. Thanks to Benjamin
+Morrise for the bug report.
+ Correct nested BODYSTRUCTURE handling [API CHANGE]
+ --------------------------------------------------
+ BODY and BODYSTRUCTURE responses are now processed recusively so
+ multipart sections within other multipart sections are returned
+ correctly. This also means that each the part of the response now has
+ a is_multipart property available.
+
+ NOTE: code that expects the old (broken) behaviour will need to be
+ updated.
+
========
0.10.2
========
from datetime import datetime
from email.utils import make_msgid
+from .fixed_offset import FixedOffset
from .imapclient import IMAPClient, DELETED, to_unicode
+ from .fixed_offset import FixedOffset
+from .response_types import Envelope, Address
from .six import binary_type, text_type, PY3
from .test.util import unittest
from .config import parse_config_file, create_client_from_config
self.assertMultiLineEqual(msginfo['RFC822'], msg)
self.assertIsInstance(msginfo['INTERNALDATE'], datetime)
self.assertIsInstance(msginfo['FLAGS'], tuple)
-
- self.assertTupleEqual(msginfo['ENVELOPE'],
- (datetime(2010, 3, 16, 16, 45, 32, tzinfo=FixedOffset(0)),
- 'A multipart message',
- (('Bob Smith', None, 'bob', 'smith.com'),),
- (('Bob Smith', None, 'bob', 'smith.com'),),
- (('Bob Smith', None, 'bob', 'smith.com'),),
- (('Some One', None, 'some', 'one.com'), (None, None, 'foo', 'foo.com')),
- None, None, None, msg_id_header))
+ self.assertSequenceEqual(msginfo['ENVELOPE'],
+ Envelope(
+ datetime(2010, 3, 16, 16, 45, 32, tzinfo=FixedOffset(0)),
+ 'A multipart message',
+ (Address('Bob Smith', None, 'bob', 'smith.com'),),
+ (Address('Bob Smith', None, 'bob', 'smith.com'),),
+ (Address('Bob Smith', None, 'bob', 'smith.com'),),
+ (Address('Some One', None, 'some', 'one.com'),
+ Address(None, None, 'foo', 'foo.com')),
+ None, None, None, msg_id_header))
def test_partial_fetch(self):
self.client.append(self.base_folder, MULTIPART_MESSAGE)