Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
97dfad78
Commit
97dfad78
authored
Sep 20, 2014
by
R David Murray
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
#21079: is_attachment now looks only at the value, ignoring parameters.
parent
9833fcbc
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
6 additions
and
4 deletions
+6
-4
Lib/email/message.py
Lib/email/message.py
+1
-3
Lib/test/test_email/test_message.py
Lib/test/test_email/test_message.py
+2
-1
Misc/NEWS
Misc/NEWS
+3
-0
No files found.
Lib/email/message.py
View file @
97dfad78
...
...
@@ -941,9 +941,7 @@ class MIMEPart(Message):
@
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
:
...
...
Lib/test/test_email/test_message.py
View file @
97dfad78
...
...
@@ -729,7 +729,8 @@ class TestEmailMessageBase:
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
):
...
...
Misc/NEWS
View file @
97dfad78
...
...
@@ -32,6 +32,9 @@ Core and Builtins
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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment