[issue1974] email.MIMEText.MIMEText.as_string incorrectly folding long subject header

Andi Albrecht report at bugs.python.org
Sun Jun 22 14:06:54 CEST 2008


Andi Albrecht <albrecht.andi at gmail.com> added the comment:

For me this issue seems to be a duplicate of issue1645148.

In my opinion the test case that checks if headers created by strings or
Header instances are equal is incorrect. It shouldn't set the
continuation whitespace explicitly when creating a Headers instance. I
would expect that

  A) msg['aheader'] = 'a long string that breaks, but shortened here'

and

  B) msg['aheader'] = Header('a long string that breaks, but shortened
here')

result in the same output. But for A) a Header instance is initialized
in Generator._write_headers() with continuation_ws set to `\t` and for
B) the default ' ' is used (see http://bugs.python.org/msg31102).

I'm uploading a patch that modifies test_string_headerinst_eq() to what
I think it should look like with this message. Of course, this test will
fail at the moment, but maybe you agree that the Header instance in this
test should be initialized without explicitly setting continuation_ws.

----------
keywords: +patch
nosy: +aalbrecht
Added file: http://bugs.python.org/file10700/py_issue1974.diff

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


More information about the Python-bugs-list mailing list