[Python-checkins] cpython: Fix glitches in email.policy docs (#12208)
eric.araujo
python-checkins at python.org
Sat Dec 3 16:01:29 CET 2011
http://hg.python.org/cpython/rev/9ffb00748a47
changeset: 73825:9ffb00748a47
user: Éric Araujo <merwok at netwok.org>
date: Sat Dec 03 16:00:56 2011 +0100
summary:
Fix glitches in email.policy docs (#12208)
files:
Doc/library/email.policy.rst | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/Doc/library/email.policy.rst b/Doc/library/email.policy.rst
--- a/Doc/library/email.policy.rst
+++ b/Doc/library/email.policy.rst
@@ -48,16 +48,18 @@
>>> import email.policy
>>> from subprocess import Popen, PIPE
>>> with open('mymsg.txt', 'b') as f:
- ... Msg = msg_from_binary_file(f, policy=email.policy.mbox)
+ ... msg = msg_from_binary_file(f, policy=email.policy.mbox)
>>> p = Popen(['sendmail', msg['To'][0].address], stdin=PIPE)
>>> g = BytesGenerator(p.stdin, policy=email.policy.SMTP)
>>> g.flatten(msg)
>>> p.stdin.close()
>>> rc = p.wait()
+.. XXX email.policy.mbox/MBOX does not exist yet
+
Some email package methods accept a *policy* keyword argument, allowing the
policy to be overridden for that method. For example, the following code uses
-the :meth:`email.message.Message.as_string` method of the *msg* object from the
+the :meth:`~email.message.Message.as_string` method of the *msg* object from the
previous example and re-write it to a file using the native line separators for
the platform on which it is running::
--
Repository URL: http://hg.python.org/cpython
More information about the Python-checkins
mailing list