This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Title: email.policy doc example passes 'policy' to as_string, but that doesn't work
Type: behavior Stage: resolved
Components: Documentation, email Versions: Python 3.3, Python 3.4
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: docs@python Nosy List: barry, docs@python, python-dev, r.david.murray
Priority: normal Keywords: patch

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.

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.

New changeset 8fbaf4e649af by R David Murray in branch '3.3':
#18600: In 3.3, as_string does not accept a policy keyword.

New changeset b9a5b7e3b32f by R David Murray in branch 'default':
Null merge related to #18600.
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).
Date User Action Args
2022-04-11 14:57:48adminsetgithub: 62800
2013-08-09 20:22:20r.david.murraysetstatus: open -> closed
resolution: fixed
messages: + msg194767

stage: patch review -> resolved
2013-08-09 20:20:27python-devsetnosy: + python-dev
messages: + msg194766
2013-08-09 19:52:21r.david.murraysetfiles: + as_string_policy.patch
keywords: + patch
messages: + msg194759

stage: needs patch -> patch review
2013-07-30 15:19:20r.david.murraycreate