Skip to content

Commit 4a0b60c

Browse files
committed
Merge #11555 as_string doc fix from 3.1.
2 parents b78b4d7 + 7dedcb4 commit 4a0b60c

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
@@ -157,8 +157,7 @@ def as_string(self, unixfrom=False, maxheaderlen=0):
157157
header.
158158
159159
This is a convenience method and may not generate the message exactly
160-
as you intend because by default it mangles lines that begin with
161-
"From ". For more flexibility, use the flatten() method of a
160+
as you intend. For more flexibility, use the flatten() method of a
162161
Generator instance.
163162
"""
164163
from email.generator import Generator

0 commit comments

Comments
 (0)