[Python-checkins] r87417 - in python/branches/release27-maint: Lib/email/generator.py Lib/email/test/test_email.py
r.david.murray
python-checkins at python.org
Tue Dec 21 19:12:50 CET 2010
Author: r.david.murray
Date: Tue Dec 21 19:12:50 2010
New Revision: 87417
Log:
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.
........
Modified:
python/branches/release27-maint/ (props changed)
python/branches/release27-maint/Lib/email/generator.py
python/branches/release27-maint/Lib/email/test/test_email.py
Modified: python/branches/release27-maint/Lib/email/generator.py
==============================================================================
--- python/branches/release27-maint/Lib/email/generator.py (original)
+++ python/branches/release27-maint/Lib/email/generator.py Tue Dec 21 19:12:50 2010
@@ -208,7 +208,8 @@
# 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 >> self._fp, msg.preamble
Modified: python/branches/release27-maint/Lib/email/test/test_email.py
==============================================================================
--- python/branches/release27-maint/Lib/email/test/test_email.py (original)
+++ python/branches/release27-maint/Lib/email/test/test_email.py Tue Dec 21 19:12:50 2010
@@ -179,6 +179,17 @@
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.
More information about the Python-checkins
mailing list