classification
Title: email policy needs a mangle_from setting
Type: enhancement Stage: resolved
Components: email Versions: Python 3.5
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: barry, gennad, holdenweb, python-dev, r.david.murray, zvyn
Priority: normal Keywords: easy, patch

Created on 2013-12-30 23:35 by r.david.murray, last changed 2015-05-17 18:25 by r.david.murray. This issue is now closed.

Files
File name Uploaded Description Edit
20098.patch gennad, 2014-01-01 16:55 review
mangle_from.patch zvyn, 2014-03-03 15:01 sets default value for mangle_from_ in Policy and changes Generator to use it if not given explicitly. review
mangle_from_with_doc.patch zvyn, 2014-03-09 22:43 review
mangle_from_20140424.patch zvyn, 2014-04-24 12:24 review
Messages (11)
msg207116 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2013-12-30 23:35
I missed this.  It still defaults to True in Generator.  It should default to False in the new policies (but True in compat32).
msg207136 - (view) Author: Gennadiy Zlobin (gennad) * Date: 2014-01-01 16:55
I created the patch, please review it.
msg207140 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2014-01-01 23:48
Sorry, my message wasn't clear.  The current default needs to remain the same.  What needs to be added is email.policy.Policy.mange_from, which should be True in the compat32 policy and False in EmailPolicy. Then it needs to be hooked up the Generator, so that an explicit specificaion in the __init__ overrides the policy, but specifying one of EmailPolicy dervived policies will override the default value of the __init__ argument if the argument is not speicifed explicitly in the Generator constructor call.  (Backward compatibility is a pain.)
msg212636 - (view) Author: Milan Oberkirch (zvyn) * Date: 2014-03-03 13:36
(@r.david.murray) I just implemented what you suggested:
- Policy has a mangle_from_ property, overridden in EMailPolicy
- Generator and DecodedGenerator default to policy.mangle_from_ or True if policy is None.

Would be glad if it helps :)
msg212641 - (view) Author: Milan Oberkirch (zvyn) * Date: 2014-03-03 15:01
Updates patch to include necessary changes to test_policy.py.
msg212992 - (view) Author: Milan Oberkirch (zvyn) * Date: 2014-03-09 22:27
Added documentation for mangle_from. since the name "mangle_from_" is not supported by the markup, changed it to "mangle_from" everywhere, which looks better anyway (I understand why it was the other way so). If it was a bad idea, I can undo it but am unable to do the doc.
msg212995 - (view) Author: Milan Oberkirch (zvyn) * Date: 2014-03-09 22:37
Rollback to mangle_from_, sorry for the noise.
msg215088 - (view) Author: Steve Holden (holdenweb) * (Python committer) Date: 2014-03-28 22:48
This is an easy issue?
msg217122 - (view) Author: Milan Oberkirch (zvyn) * Date: 2014-04-24 12:13
Updated the last patch according to the review comments at https://bugs.python.org/review/20098/.
msg243419 - (view) Author: Roundup Robot (python-dev) Date: 2015-05-17 18:24
New changeset df81f9b67736 by R David Murray in branch 'default':
#20098: add mangle_from_ policy option.
https://hg.python.org/cpython/rev/df81f9b67736
msg243420 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2015-05-17 18:25
Thanks, Milan.
History
Date User Action Args
2015-05-17 18:25:22r.david.murraysetstatus: open -> closed
resolution: fixed
messages: + msg243420

stage: patch review -> resolved
2015-05-17 18:24:51python-devsetnosy: + python-dev
messages: + msg243419
2014-04-24 12:24:26zvynsetfiles: - mangle_from_20140424.patch
2014-04-24 12:24:14zvynsetfiles: + mangle_from_20140424.patch
2014-04-24 12:13:30zvynsetfiles: + mangle_from_20140424.patch

messages: + msg217122
2014-03-28 22:48:41holdenwebsetnosy: + holdenweb
messages: + msg215088
2014-03-16 09:17:30berker.peksagsetstage: needs patch -> patch review
2014-03-09 22:43:12zvynsetfiles: - mangle_from_with_doc.patch
2014-03-09 22:43:01zvynsetfiles: + mangle_from_with_doc.patch
2014-03-09 22:38:12zvynsetfiles: - mangle_from_with_doc.patch
2014-03-09 22:37:40zvynsetfiles: + mangle_from_with_doc.patch

messages: + msg212995
2014-03-09 22:27:57zvynsetfiles: + mangle_from_with_doc.patch

messages: + msg212992
2014-03-03 15:01:04zvynsetfiles: + mangle_from.patch

messages: + msg212641
2014-03-03 14:57:29zvynsetfiles: - mangle_from.patch
2014-03-03 13:36:15zvynsetfiles: + mangle_from.patch
nosy: + zvyn
messages: + msg212636

2014-01-01 23:48:10r.david.murraysetmessages: + msg207140
2014-01-01 16:55:56gennadsetfiles: + 20098.patch

nosy: + gennad
messages: + msg207136

keywords: + patch
2013-12-30 23:35:17r.david.murraycreate