Ported 42075 from release23-maint branch.

SF bug #1403349 solution for email 3.0; some MUAs use the 'file' parameter
name in the Content-Distribution header, so Message.get_filename() should fall
back to using that.  Will port to the Python 2.5 trunk.

Also, bump the email package version to 3.0.1 for eventual release.  Of
course, add a test case too.

XXX Need to update the documentation.
This commit is contained in:
Barry Warsaw 2006-01-17 04:49:07 +00:00
parent 989b69a519
commit a0f28efcd1
4 changed files with 51 additions and 5 deletions

View file

@ -1,4 +1,4 @@
# Copyright (C) 2001-2004 Python Software Foundation
# Copyright (C) 2001-2006 Python Software Foundation
# Contact: email-sig@python.org
# email package unit tests
@ -147,6 +147,13 @@ class TestMessageAPI(TestEmailBase):
subpart = msg.get_payload(1)
eq(subpart.get_filename(), 'dingusfish.gif')
def test_get_filename_with_name_parameter(self):
eq = self.assertEqual
msg = self._msgobj('msg_44.txt')
filenames = [p.get_filename() for p in msg.get_payload()]
eq(filenames, ['msg.txt', 'msg.txt'])
def test_get_boundary(self):
eq = self.assertEqual
msg = self._msgobj('msg_07.txt')