mirror of
https://github.com/python/cpython.git
synced 2025-11-27 21:55:35 +00:00
Fix issue #1822: MIMEMultipart.is_multipart() behaves correctly for a
just-created (and empty) instance. Added tests for this. Thanks Jonathan Share.
This commit is contained in:
parent
96f2184de6
commit
2b1b195d39
3 changed files with 12 additions and 0 deletions
|
|
@ -34,6 +34,12 @@ class MIMEMultipart(MIMEBase):
|
||||||
keyword arguments (or passed into the _params argument).
|
keyword arguments (or passed into the _params argument).
|
||||||
"""
|
"""
|
||||||
MIMEBase.__init__(self, 'multipart', _subtype, **_params)
|
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:
|
if _subparts:
|
||||||
for p in _subparts:
|
for p in _subparts:
|
||||||
self.attach(p)
|
self.attach(p)
|
||||||
|
|
|
||||||
|
|
@ -1861,6 +1861,9 @@ message 2
|
||||||
eq(msg.get_payload(0), text1)
|
eq(msg.get_payload(0), text1)
|
||||||
eq(msg.get_payload(1), text2)
|
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
|
# A general test of parser->model->generator idempotency. IOW, read a message
|
||||||
|
|
|
||||||
|
|
@ -367,6 +367,9 @@ Core and builtins
|
||||||
Library
|
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
|
- #1861: Added an attribute to the sched module which returns an ordered
|
||||||
list of upcoming events (displayed as named tuples).
|
list of upcoming events (displayed as named tuples).
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue