classification
Title: Provisional new email API: new policy implementing custom header objects
Type: enhancement Stage: resolved
Components: email Versions: Python 3.3
process
Status: closed Resolution: fixed
Dependencies: 14731 Superseder:
Assigned To: Nosy List: barry, python-dev, r.david.murray
Priority: normal Keywords: patch

Created on 2011-07-19 18:24 by r.david.murray, last changed 2012-05-26 03:30 by r.david.murray. This issue is now closed.

Files
File name Uploaded Description Edit
email6.patch r.david.murray, 2012-05-24 03:01
Messages (6)
msg140687 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2011-07-19 18:24
The work I've been doing on email6 has reached a stage where I'm confident about the overall plan of the new code, and am ready for people to review it and make suggestions.  The patch represents a working state of the code, but with several omissions that I will continue to work on while the rest of the code is reviewed.  The major omissions are that address headers don't yet handle encoded words in their 'value' and related attributes, and that structured headers do not properly support unicode characters when the message is flattened.  (The traditional email5 methods for handling unicode in structured headers still work fine, though).  There are also edge-cases where the address parser does not do as well as email.utils.parseaddr (and other cases where it does better).

A goal of email6 is to be 100% backward compatible with the existing email5.1 API.  If you find any deviations please let me know.

A new policy, email6_defaults, allows you to run the code with what are intended to be the defaults in Python 3.4.  (Not specifying either email6_defaults or email5_defaults when creating a message will result in warning messages in cases where it would make a difference which policy was in force).  The only difference between the two right now is that email6_defaults sets 'use_decoded' true, which means that the string value of header objects is the fully unicode version, not the ASCII-only version that comes from the source as is true with email5_defaults.

I've also released this version of the code as email-6.0.0a1 on pypi, so that it can be tested using 3.2 (you import it as 'email6').

I will separately attach here the README from the pypi package, which details the header features that are finished and the ones that still need work.

After review, I'd like to go ahead and check this in to default and continue the work from there.  From this point until I start work on the message_factory all changes will be incremental.  When we originally planned out email6 we thought we'd be making a "compatibility break" with backward compatibility shims.  As things have turned out the work is more a matter of incremental improvement of the API while maintaining the old API, and thus it seems reasonable to me to work on it directly in default rather than continue to work on it in a separate feature branch.

If, that is, the approach here is accepted :)  The email-sig seems to like it.

Oh, yeah, and there's room for plenty of bike-shedding about certain attribute names &c.
msg161171 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2012-05-19 23:41
As mentioned on python-dev, I'm planning to introduce the new header parsing/folding code as a provisional API in the spirit if not quite the letter of PEP 411.  Issue 14731 is a pre-requisite for this issue, since this patch builds on to of that one.

This patch is almost entirely additions.  At a later stage I can probably remove some of the older code, but the bulk of the backward compatibility stuff may have to remain around until Python4.
msg161628 - (view) Author: Roundup Robot (python-dev) Date: 2012-05-25 22:44
New changeset 0189b9d2d6bc by R David Murray in branch 'default':
#12586: add provisional email policy with new header parsing and folding.
http://hg.python.org/cpython/rev/0189b9d2d6bc
msg161638 - (view) Author: Roundup Robot (python-dev) Date: 2012-05-26 02:26
New changeset 331cceee3b45 by R David Murray in branch 'default':
#12586: Expand What's New email entry with provisional policy features.
http://hg.python.org/cpython/rev/331cceee3b45
msg161640 - (view) Author: Roundup Robot (python-dev) Date: 2012-05-26 02:33
New changeset 09e97829ed1e by R David Murray in branch 'default':
Add news entries for #14731 and #12586.
http://hg.python.org/cpython/rev/09e97829ed1e
msg161641 - (view) Author: Roundup Robot (python-dev) Date: 2012-05-26 02:53
New changeset 2b6f183091b9 by R David Murray in branch 'default':
#12586: Fix a small oversight in the new email policy header setting code.
http://hg.python.org/cpython/rev/2b6f183091b9
History
Date User Action Args
2012-05-26 03:30:28r.david.murraysetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2012-05-26 02:53:21python-devsetmessages: + msg161641
2012-05-26 02:33:51python-devsetmessages: + msg161640
2012-05-26 02:26:28python-devsetmessages: + msg161638
2012-05-25 22:44:01python-devsetnosy: + python-dev
messages: + msg161628
2012-05-24 14:50:15r.david.murraylinkissue12553 dependencies
2012-05-24 03:01:36r.david.murraysetfiles: + email6.patch
2012-05-24 03:01:06r.david.murraysetfiles: - email6.patch
2012-05-21 00:08:34r.david.murraysetfiles: + email6.patch
2012-05-21 00:07:56r.david.murraysetfiles: - email6.patch
2012-05-19 23:42:05r.david.murraysetfiles: + email6.patch

dependencies: + Enhance Policy framework in preparation for adding email6 policies as provisional
assignee: r.david.murray ->
components: + email, - Library (Lib)
title: Enhanced email API: header objects -> Provisional new email API: new policy implementing custom header objects
type: enhancement
messages: + msg161171
2012-05-19 23:34:05r.david.murraysetfiles: - b22698463737.diff
2012-05-19 23:33:55r.david.murraysetfiles: - README.txt
2012-05-19 23:33:26r.david.murraysethgrepos: - hgrepo44
2012-05-16 01:55:58r.david.murraylinkissue504152 superseder
2011-07-19 18:26:48r.david.murraysetfiles: + README.txt
2011-07-19 18:25:23r.david.murraysetfiles: + b22698463737.diff
keywords: + patch
2011-07-19 18:24:20r.david.murraycreate