Roundup Robot added the comment:
New changeset 302c8fdb17e3 by R David Murray in branch 'default':
#11558: Better message if attach called on non-multipart.
http://hg.python.org/cpython/rev/302c8fdb17e3
--
nosy: +python-dev
___
Python tracker
R. David Murray added the comment:
Committed, thanks Varun.
Note that I made two changes to your patch: added a missing space in the folded
message (your second PEP8 change), and I renamed the test method to make it
clearer what was being tested.
--
stage: - committed/rejected
Varun Sharma added the comment:
Afer getting a lot of help from david on irc, i finally improved the patch. Now
it catches AttributeError and raises TypeError for non-object types in attach
function.
--
Added file: http://bugs.python.org/file34269/test_email_attach_to_string.patch
R. David Murray added the comment:
Yes, this is the right idea.
A couple of comments: I'm a bit concerned that the AttributeError might catch
something other than the specific error generated by this case, but since that
is unlikely and in any case would be revealed by the chained traceback,
Varun Sharma added the comment:
I have fixed the pep8 voilations and shortened the regex as you suggested in
the new patch.
--
Added file:
http://bugs.python.org/file34270/test_email_attach_to_string_11558.patch
___
Python tracker
R. David Murray added the comment:
You missed a PEP8 line length fix.
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11558
___
___
Varun Sharma added the comment:
Sorry :)
--
Added file:
http://bugs.python.org/file34273/test_email_attach_to_string_11558.patch
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11558
___
Varun Sharma added the comment:
I have made a patch which raises TypeError whenever a string type payload is
attached to message using email.Message.attach() method.I have also added a
unit test for the same. Need review.
--
keywords: +patch
nosy: +varun
Added file:
R. David Murray added the comment:
Thanks, Varun. Your patch addresses an issue with the current API, but it
doesn't address the problem raised in this issue. The problem in this issue is
what happens when the *payload* is a string, and you call attach (to attach a
message object) on that
New submission from Michael Henry pyt...@drmikehenry.com:
The attached test program, test_email_attach_to_string.py, demonstrates the
desire for email.message.Message.attach to raise a more helpful exception when
the user incorrectly invokes attach() after setting the payload to a string.
10 matches
Mail list logo