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
06fa0420
Commit
06fa0420
authored
Aug 16, 2004
by
Barry Warsaw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Test cases and fixes for bugs described in patch #873418: email/Message.py:
del_param fails when specifying a header.
parent
d4ff2069
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
2 deletions
+14
-2
Lib/email/Message.py
Lib/email/Message.py
+2
-2
Lib/email/test/test_email.py
Lib/email/test/test_email.py
+12
-0
No files found.
Lib/email/Message.py
View file @
06fa0420
...
...
@@ -664,7 +664,7 @@ class Message:
if not self.has_key(header):
return
new_ctype = ''
for p, v in self.get_params(header, unquote=requote):
for p, v in self.get_params(header
=header
, unquote=requote):
if p.lower() <> param.lower():
if not new_ctype:
new_ctype = _formatparam(p, v, requote)
...
...
@@ -700,7 +700,7 @@ class Message:
if not self.has_key(header):
self[header] = type
return
params = self.get_params(header, unquote=requote)
params = self.get_params(header
=header
, unquote=requote)
del self[header]
self[header] = type
# Skip the first param; it's the old type.
...
...
Lib/email/test/test_email.py
View file @
06fa0420
...
...
@@ -354,6 +354,12 @@ class TestMessageAPI(TestEmailBase):
(
'boundary'
,
'D1690A7AC1.996856090/mail.example.com'
),
(
'report-type'
,
old_val
)])
def
test_del_param_on_other_header
(
self
):
msg
=
Message
()
msg
.
add_header
(
'Content-Disposition'
,
'attachment'
,
filename
=
'bud.gif'
)
msg
.
del_param
(
'filename'
,
'content-disposition'
)
self
.
assertEqual
(
msg
[
'content-disposition'
],
'attachment'
)
def
test_set_type
(
self
):
eq
=
self
.
assertEqual
msg
=
Message
()
...
...
@@ -365,6 +371,12 @@ class TestMessageAPI(TestEmailBase):
msg
.
set_type
(
'text/html'
)
eq
(
msg
[
'content-type'
],
'text/html; charset="us-ascii"'
)
def
test_set_type_on_other_header
(
self
):
msg
=
Message
()
msg
[
'X-Content-Type'
]
=
'text/plain'
msg
.
set_type
(
'application/octet-stream'
,
'X-Content-Type'
)
self
.
assertEqual
(
msg
[
'x-content-type'
],
'application/octet-stream'
)
def
test_get_content_type_missing
(
self
):
msg
=
Message
()
self
.
assertEqual
(
msg
.
get_content_type
(),
'text/plain'
)
...
...
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