changeset: 92492:0044ed0af96f branch: 3.4 parent: 92490:bf6163635eda user: R David Murray date: Sat Sep 20 17:44:53 2014 -0400 files: Lib/email/message.py Lib/test/test_email/test_message.py Misc/NEWS description: #21079: is_attachment now looks only at the value, ignoring parameters. diff -r bf6163635eda -r 0044ed0af96f Lib/email/message.py --- a/Lib/email/message.py Sat Sep 20 11:53:12 2014 -0400 +++ b/Lib/email/message.py Sat Sep 20 17:44:53 2014 -0400 @@ -941,9 +941,7 @@ @property def is_attachment(self): c_d = self.get('content-disposition') - if c_d is None: - return False - return c_d.lower() == 'attachment' + return False if c_d is None else c_d.content_disposition == 'attachment' def _find_body(self, part, preferencelist): if part.is_attachment: diff -r bf6163635eda -r 0044ed0af96f Lib/test/test_email/test_message.py --- a/Lib/test/test_email/test_message.py Sat Sep 20 11:53:12 2014 -0400 +++ b/Lib/test/test_email/test_message.py Sat Sep 20 17:44:53 2014 -0400 @@ -729,7 +729,8 @@ self.assertTrue(m.is_attachment) m.replace_header('Content-Disposition', 'AtTachMent') self.assertTrue(m.is_attachment) - + m.set_param('filename', 'abc.png', 'Content-Disposition') + self.assertTrue(m.is_attachment) class TestEmailMessage(TestEmailMessageBase, TestEmailBase): diff -r bf6163635eda -r 0044ed0af96f Misc/NEWS --- a/Misc/NEWS Sat Sep 20 11:53:12 2014 -0400 +++ b/Misc/NEWS Sat Sep 20 17:44:53 2014 -0400 @@ -32,6 +32,9 @@ Library ------- +- Issue #21079: Fix email.message.EmailMessage.is_attachment to return the + correct result when the header has parameters as well as a value. + - Issue #22247: Add NNTPError to nntplib.__all__. - Issue #4180: The warnings registries are now reset when the filters