summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorR. David Murray <rdmurray@bitdance.com>2010-12-21 18:11:01 (GMT)
committerR. David Murray <rdmurray@bitdance.com>2010-12-21 18:11:01 (GMT)
commit27c1914c1bd0193e0c8ef6fa15854f767bbb0425 (patch)
treebbfee9e7a4d6c52a3a34387eceff17e899391171 /Lib
parent08d3c1e713f99c8f20bc797e143420bf79ecf04a (diff)
downloadcpython-27c1914c1bd0193e0c8ef6fa15854f767bbb0425.zip
cpython-27c1914c1bd0193e0c8ef6fa15854f767bbb0425.tar.gz
cpython-27c1914c1bd0193e0c8ef6fa15854f767bbb0425.tar.bz2
Merged revisions 87415 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k ........ r87415 | r.david.murray | 2010-12-21 13:07:59 -0500 (Tue, 21 Dec 2010) | 4 lines Fix the change made for issue 1243654. Surprisingly, it turns out there was no test that exercised this code path. ........
Diffstat (limited to 'Lib')
-rw-r--r--Lib/email/generator.py3
-rw-r--r--Lib/email/test/test_email.py11
2 files changed, 13 insertions, 1 deletions
diff --git a/Lib/email/generator.py b/Lib/email/generator.py
index cf5e092..cc30aff 100644
--- a/Lib/email/generator.py
+++ b/Lib/email/generator.py
@@ -186,7 +186,8 @@ class Generator:
# Create a boundary that doesn't appear in any of the
# message texts.
alltext = NL.join(msgtexts)
- msg.set_boundary(self._make_boundary(alltext))
+ boundary = _make_boundary(alltext)
+ msg.set_boundary(boundary)
# If there's a preamble, write it out, with a trailing CRLF
if msg.preamble is not None:
print(msg.preamble, file=self._fp)
diff --git a/Lib/email/test/test_email.py b/Lib/email/test/test_email.py
index ee991ee..c9903ec 100644
--- a/Lib/email/test/test_email.py
+++ b/Lib/email/test/test_email.py
@@ -178,6 +178,17 @@ class TestMessageAPI(TestEmailBase):
self.assertRaises(errors.HeaderParseError,
msg.set_boundary, 'BOUNDARY')
+ def test_make_boundary(self):
+ msg = MIMEMultipart('form-data')
+ # Note that when the boundary gets created is an implementation
+ # detail and might change.
+ self.assertEqual(msg.items()[0][1], 'multipart/form-data')
+ # Trigger creation of boundary
+ msg.as_string()
+ self.assertEqual(msg.items()[0][1][:33],
+ 'multipart/form-data; boundary="==')
+ # XXX: there ought to be tests of the uniqueness of the boundary, too.
+
def test_message_rfc822_only(self):
# Issue 7970: message/rfc822 not in multipart parsed by
# HeaderParser caused an exception when flattened.