classification
Title: whitespace folding in the email package could be better ;-)
Type: behavior Stage: resolved
Components: Library (Lib) Versions: Python 3.3
process
Status: closed Resolution: duplicate
Dependencies: Superseder: email.header.Header doesn't fold headers correctly
View: 11492
Assigned To: r.david.murray Nosy List: barry, cjw296, r.david.murray, terry.reedy
Priority: normal Keywords:

Created on 2009-03-30 18:25 by cjw296, last changed 2011-04-18 15:11 by r.david.murray. This issue is now closed.

Messages (6)
msg84603 - (view) Author: Chris Withers (cjw296) * (Python committer) Date: 2009-03-30 18:25
In python 3 this has been done better already, but in python2.7 we still
have this problem:

>>> from email.mime.text import MIMEText
>>> m = MIMEText('foo')
>>> m['Subject'] = 'AA  '*40
>>> str(m)
'From nobody Mon Mar 30 13:22:44 2009\nContent-Type: text/plain;
charset="us-ascii"\nMIME-Version: 1.0\nContent-Transfer-Encoding:
7bit\nSubject: AA AA AA AA AA AA AA AA AA AA AA AA AA AA AA AA AA AA AA
AA AA AA AA\n\tAA AA AA AA AA AA AA AA AA AA AA AA AA AA AA AA AA \n\nfoo'

Note that all the AA's are single spaced, even though they were supposed
to be double spaced.

It should be noted that the fix for [issue1974] actually relies on this
bug for the fix to work properly ;-) More work will be required to fix
that bug when this bug is fixed :-(
msg113046 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2010-08-05 20:38
The email module has several problems. RDM is working on overhauling the email module for 3.2. Existing issues may not get individual attention.
msg113132 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2010-08-06 20:24
Yes, this is being kept in mind for email6, but nothing is likely to happen in the current package.  Since email6 won't make 3.2, I'm retargeting this bug for 3.3.
msg113162 - (view) Author: Chris Withers (cjw296) * (Python committer) Date: 2010-08-07 10:13
What's email6 and where can I find out more about it?

Chris
msg113179 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2010-08-07 15:01
It's a plan to redesign the email API so that it can easily manipulate both bytes and strings as needed, with a backward compatibility layer that allows the current API to be used if all you need to do is process strings.  If we're lucky there may be a PyPI package that backports it to 2.x, although there the backward compatibility API will probably only work if you don't ever want to decode the message to unicode :(.

It is a project of the email-sig, but currently I'm the only one actively working on the code.

There are design documents in the wiki:

    http://wiki.python.org/moin/Email%20SIG

the current code (which of course is in the middle of various transformations and the docs aren't completely up to date) is on launchpad in deference to Barry:

    https://launchpad.net/python-email6

I welcome your comments!

(*) email4 is the package in most of the actively used versions of Python2.x, email5 is the version in 3.0/3.1/3.2, email6 will hopefully be the version in 3.3.
msg133975 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2011-04-18 15:11
This now works correctly in 3.2/3.3 (see issue 11492).  Note that the whitespace compression is too deeply embeded in the 2.7 email package for there to be any way to fix it there.
History
Date User Action Args
2011-04-18 15:11:16r.david.murraysetstatus: open -> closed
resolution: duplicate
messages: + msg133975

superseder: email.header.Header doesn't fold headers correctly
stage: test needed -> resolved
2010-08-07 15:02:00r.david.murraysetmessages: + msg113179
2010-08-07 10:13:12cjw296setmessages: + msg113162
2010-08-06 20:24:19r.david.murraysettype: behavior
stage: test needed
messages: + msg113132
versions: + Python 3.3, - Python 2.7
2010-08-05 20:38:33terry.reedysetnosy: + terry.reedy
messages: + msg113046
2010-05-05 13:47:07barrysetassignee: barry -> r.david.murray

nosy: + r.david.murray
2010-01-11 17:45:13r.david.murraylinkissue1422094 superseder
2009-03-30 18:25:14cjw296create