[Python-checkins] r60073 - in python/trunk: Lib/email/mime/multipart.py Lib/email/test/test_email.py Misc/NEWS
facundo.batista
python-checkins at python.org
Sat Jan 19 13:32:27 CET 2008
Author: facundo.batista
Date: Sat Jan 19 13:32:27 2008
New Revision: 60073
Modified:
python/trunk/Lib/email/mime/multipart.py
python/trunk/Lib/email/test/test_email.py
python/trunk/Misc/NEWS
Log:
Fix issue #1822: MIMEMultipart.is_multipart() behaves correctly for a
just-created (and empty) instance. Added tests for this. Thanks
Jonathan Share.
Modified: python/trunk/Lib/email/mime/multipart.py
==============================================================================
--- python/trunk/Lib/email/mime/multipart.py (original)
+++ python/trunk/Lib/email/mime/multipart.py Sat Jan 19 13:32:27 2008
@@ -34,6 +34,12 @@
keyword arguments (or passed into the _params argument).
"""
MIMEBase.__init__(self, 'multipart', _subtype, **_params)
+
+ # Initialise _payload to an empty list as the Message superclass's
+ # implementation of is_multipart assumes that _payload is a list for
+ # multipart messages.
+ self._payload = []
+
if _subparts:
for p in _subparts:
self.attach(p)
Modified: python/trunk/Lib/email/test/test_email.py
==============================================================================
--- python/trunk/Lib/email/test/test_email.py (original)
+++ python/trunk/Lib/email/test/test_email.py Sat Jan 19 13:32:27 2008
@@ -1861,6 +1861,9 @@
eq(msg.get_payload(0), text1)
eq(msg.get_payload(1), text2)
+ def test_default_multipart_constructor(self):
+ msg = MIMEMultipart()
+ self.assertTrue(msg.is_multipart())
# A general test of parser->model->generator idempotency. IOW, read a message
Modified: python/trunk/Misc/NEWS
==============================================================================
--- python/trunk/Misc/NEWS (original)
+++ python/trunk/Misc/NEWS Sat Jan 19 13:32:27 2008
@@ -367,6 +367,9 @@
Library
-------
+- #1822: MIMEMultipart.is_multipart() behaves correctly for a just-created
+ (and empty) instance. Thanks Jonathan Share.
+
- #1861: Added an attribute to the sched module which returns an ordered
list of upcoming events (displayed as named tuples).
More information about the Python-checkins
mailing list