[issue7970] email.Generator fails to flatten message parsed by email.Parser

R. David Murray report at bugs.python.org
Sat Feb 20 05:32:23 CET 2010


R. David Murray <rdmurray at bitdance.com> added the comment:

The problem only arises with HeaderParser.  The full parser turns the body into a list containing a Message object, because that's how the email package models the message structure.  HeaderParser treats the body as a single string.  All that is fine, but generator's flatten method has special handlers for certain mime types, and message/rfc822 is one of them.  It is looking for what it "knows" the message/rfc822 body looks like (a list containing a Message), but what it finds is a string.

The fix is probably to special case get_payload returning a string inside the _handle_message.  I've attached a patch that adds your test file as a unit test and provides that fix.

----------
assignee:  -> r.david.murray
nosy: +r.david.murray
priority:  -> normal
stage:  -> patch review

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue7970>
_______________________________________


More information about the Python-bugs-list mailing list