[issue11558] Raise a more helpful exception in email.message.Message.attach after set_payload(some string)

2014-03-06 Thread Roundup Robot
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

[issue11558] Raise a more helpful exception in email.message.Message.attach after set_payload(some string)

2014-03-06 Thread R. David Murray
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

[issue11558] Raise a more helpful exception in email.message.Message.attach after set_payload(some string)

2014-03-02 Thread Varun Sharma
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

[issue11558] Raise a more helpful exception in email.message.Message.attach after set_payload(some string)

2014-03-02 Thread R. David Murray
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,

[issue11558] Raise a more helpful exception in email.message.Message.attach after set_payload(some string)

2014-03-02 Thread Varun Sharma
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

[issue11558] Raise a more helpful exception in email.message.Message.attach after set_payload(some string)

2014-03-02 Thread R. David Murray
R. David Murray added the comment: You missed a PEP8 line length fix. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11558 ___ ___

[issue11558] Raise a more helpful exception in email.message.Message.attach after set_payload(some string)

2014-03-02 Thread Varun Sharma
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 ___

[issue11558] Raise a more helpful exception in email.message.Message.attach after set_payload(some string)

2014-03-01 Thread Varun Sharma
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:

[issue11558] Raise a more helpful exception in email.message.Message.attach after set_payload(some string)

2014-03-01 Thread R. David Murray
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

[issue11558] Raise a more helpful exception in email.message.Message.attach after set_payload(some string)

2011-03-15 Thread Michael Henry
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.