Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 7dedcb4

Browse files
committed
#11555: update doc for 3.x change to as_string mangle_from default.
1 parent 8beaa6c commit 7dedcb4

2 files changed

Lines changed: 5 additions & 5 deletions

File tree

Doc/library/email.message.rst

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,15 +46,16 @@ Here are the methods of the :class:`Message` class:
4646
be generated or modified).
4747

4848
Note that this method is provided as a convenience and may not always
49-
format the message the way you want. For example, by default it mangles
50-
lines that begin with ``From``. For more flexibility, instantiate a
49+
format the message the way you want. For example, by default it does
50+
not do the mangling of lines that begin with ``From`` that is
51+
required by the unix mbox format. For more flexibility, instantiate a
5152
:class:`~email.generator.Generator` instance and use its :meth:`flatten`
5253
method directly. For example::
5354

5455
from io import StringIO
5556
from email.generator import Generator
5657
fp = StringIO()
57-
g = Generator(fp, mangle_from_=False, maxheaderlen=60)
58+
g = Generator(fp, mangle_from_=True, maxheaderlen=60)
5859
g.flatten(msg)
5960
text = fp.getvalue()
6061

Lib/email/message.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,8 +136,7 @@ def as_string(self, unixfrom=False, maxheaderlen=0):
136136
header.
137137
138138
This is a convenience method and may not generate the message exactly
139-
as you intend because by default it mangles lines that begin with
140-
"From ". For more flexibility, use the flatten() method of a
139+
as you intend. For more flexibility, use the flatten() method of a
141140
Generator instance.
142141
"""
143142
from email.generator import Generator

0 commit comments

Comments
 (0)