From: Menno Smits Date: Wed, 7 May 2014 12:08:51 +0000 (+1200) Subject: Merged from trunk X-Git-Tag: 0.11~3^2~6 X-Git-Url: http://git.khamidou.com/?a=commitdiff_plain;h=c4a3ace3245375769ac31c44a0beca3c37a9ce3c;p=imapclient.git Merged from trunk --- c4a3ace3245375769ac31c44a0beca3c37a9ce3c diff --cc NEWS.rst index 1d2b6ef,f8a3042..6779e9a --- a/NEWS.rst +++ b/NEWS.rst @@@ -8,22 -8,22 +8,32 @@@ The new gmail_search methods allows dir 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 ======== diff --cc imapclient/livetest.py index 32edc70,357daa1..b1a9978 --- a/imapclient/livetest.py +++ b/imapclient/livetest.py @@@ -15,9 -15,8 +15,10 @@@ import tim 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 @@@ -653,17 -658,14 +654,16 @@@ def createUidTestClass(conf, use_uid) 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)