New submission from R. David Murray <rdmur...@bitdance.com>:

As part of the email6 design, the email-sig came up with the idea of 
simplifying the current email API by introducing the concept of "policy 
objects".  A policy object is an object that hold various parameters and 
methods that can be used to control the behavior of the email package.  Thus, 
instead of having 'maxheaderlen', '_mangle_from', 'unixfrom', linesep, etc, etc 
options, you have a policy object that holds settings for these options that 
are applicable to a particular domain.  Thus an 'SMTP' policy would have a 
maxheaderlen of 76, a linesep of \r\n, and _mangle_from and unixfrom false, 
while mbox would have linesep \n and _mangle_from and unixfrom True.  HTTP 
would be like SMTP, but with maxheaderlen 0 (unlimited).

The policy is passed to the parser and/or the generator construtor to control 
how input is interpreted and how output is generated.  By encapsulating the 
details into objects related to clearly defined problem domains, we make it 
much simpler to use the email package both within a domain and for translating 
messages between domains.

Originally we saw the policy object as fundamental to the whole email6 design, 
but it has become clear that it is actually a relatively independent piece, and 
by itself much smaller than the parser and generator changes required for the 
full email6 implementation.

Therefore I'm starting the email6 development with the policy object piece as a 
standalone proposal.  I'd like to see this piece get reviewed and committed 
early in the process so I can use it as an underpinning for the further work.

I've set up a feature repo for email6 at features/email6.  I've pushed the 
framework (the policy object and its docs, with a selection of the options I 
intend to implement documented) and several integration updates 
(raise_on_defect, linesep, must_be_7bit).  I thought I'd post this issue now, 
with the link to the repo, so people can give me early feedback if they wish.

Ultimately I would like to deprecate the constructor arguments that are 
subsumed by the policy object settings.

----------
assignee: r.david.murray
hgrepos: 15
messages: 132694
nosy: barry, r.david.murray
priority: normal
severity: normal
stage: patch review
status: open
title: Simplify email API via 'policy' objects
type: feature request
versions: Python 3.3

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue11731>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to