]> khamidou — GitHub mirrors - imapclient.git/commitdiff
Merged from trunk
authorMenno Smits <menno@freshfoo.com>
Wed, 7 May 2014 12:08:51 +0000 (00:08 +1200)
committerMenno Smits <menno@freshfoo.com>
Wed, 7 May 2014 12:08:51 +0000 (00:08 +1200)
1  2 
NEWS.rst
imapclient/livetest.py
imapclient/response_parser.py
imapclient/test/test_response_parser.py

diff --cc NEWS.rst
index 1d2b6ef6eec800cd8f8425939682d1ddb3e485cd,f8a3042e79fc8e8220b0ef6af1cc1a8cf086f651..6779e9a15a496dcb0324f745c464b25a61a7a1c9
+++ 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
  ========
index 32edc703e3d58c00567a9d7ddb7c9c15b8a903c0,357daa154ce5a3e5ba66e2454d3394ce89279791..b1a9978745e98ffbb023468f960dca32eb33c74f
@@@ -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)
Simple merge