Issue 18600: email.policy doc example passes 'policy' to as_string, but that doesn't work (original) (raw)

Issue18600

Created on 2013-07-30 15:19 by r.david.murray, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
as_string_policy.patch r.david.murray,2013-08-09 19:52 review
Messages (4)
msg193937 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2013-07-30 15:19
When I wrote those docs I intended to add a policy argument to as_string, but did not do it by the time 3.3 was released. The docs for 3.3 need to be corrected, and I need to decide if I do want to add that keyword to as_string in 3.4 (the answer is probably yes, but I may check with the email-sig first).
msg194759 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2013-08-09 19:52
Turns out even with as_string accepting a policy keyword, the example still failed. It needs to be generating a bytes object, not a string. Before I even realized that, though, I decided I wanted to add as_bytes (and __bytes__). So the attached patch does that: adds policy to as_string, and adds new methods as_bytes and __bytes__ to Message. This patch is only for 3.4. The 3.3 patch will just delete that part of the policy example, so I'm not going to bother to upload it.
msg194766 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2013-08-09 20:20
New changeset 53287858e71f by R David Murray in branch 'default': #18600: add policy to add_string, and as_bytes and __bytes__ methods. http://hg.python.org/cpython/rev/53287858e71f New changeset 8fbaf4e649af by R David Murray in branch '3.3': #18600: In 3.3, as_string does not accept a policy keyword. http://hg.python.org/cpython/rev/8fbaf4e649af New changeset b9a5b7e3b32f by R David Murray in branch 'default': Null merge related to #18600. http://hg.python.org/cpython/rev/b9a5b7e3b32f
msg194767 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2013-08-09 20:22
Committed with changes pointed out by Antoine (thank you Antoine).
History
Date User Action Args
2022-04-11 14:57:48 admin set github: 62800
2013-08-09 20:22:20 r.david.murray set status: open -> closedresolution: fixedmessages: + stage: patch review -> resolved
2013-08-09 20:20:27 python-dev set nosy: + python-devmessages: +
2013-08-09 19:52:21 r.david.murray set files: + as_string_policy.patchkeywords: + patchmessages: + stage: needs patch -> patch review
2013-07-30 15:19:20 r.david.murray create