summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBarry Warsaw <barry@python.org>2003-04-18 23:03:53 (GMT)
committerBarry Warsaw <barry@python.org>2003-04-18 23:03:53 (GMT)
commitb05df5796a5a9b5962692a57775308f757b752b6 (patch)
treed8bcae814b040fe313ce214ce9b1867e916c5864
parent338bcbccfaab8d05d8278a9a67714cf759ac1ca9 (diff)
downloadcpython-b05df5796a5a9b5962692a57775308f757b752b6.zip
cpython-b05df5796a5a9b5962692a57775308f757b752b6.tar.gz
cpython-b05df5796a5a9b5962692a57775308f757b752b6.tar.bz2
Added some more documentation to as_string() to make it clear that
it's a convenience only. Give an example of what to do for more flexibility.
-rw-r--r--Doc/lib/emailmessage.tex14
1 files changed, 14 insertions, 0 deletions
diff --git a/Doc/lib/emailmessage.tex b/Doc/lib/emailmessage.tex
index 61dc74b..f580edf 100644
--- a/Doc/lib/emailmessage.tex
+++ b/Doc/lib/emailmessage.tex
@@ -36,6 +36,20 @@ The constructor takes no arguments.
Return the entire message flatten as a string. When optional
\var{unixfrom} is \code{True}, the envelope header is included in the
returned string. \var{unixfrom} defaults to \code{False}.
+
+Note that this method is provided as a convenience and may not always
+format the message the way you want. For more flexibility,
+instantiate a \class{Generator} instance and use its
+\method{flatten()} method directly. For example:
+
+\begin{verbatim}
+from cStringIO import StringIO
+from email.Generator import Generator
+fp = StringIO()
+g = Generator(mangle_from_=False, maxheaderlen=60)
+g.flatten(msg)
+text = fp.getvalue()
+\end{verbatim}
\end{methoddesc}
\begin{methoddesc}[Message]{__str__}{}