]> granicus.if.org Git - python/commitdiff
Added some more documentation to as_string() to make it clear that
authorBarry Warsaw <barry@python.org>
Fri, 18 Apr 2003 23:03:53 +0000 (23:03 +0000)
committerBarry Warsaw <barry@python.org>
Fri, 18 Apr 2003 23:03:53 +0000 (23:03 +0000)
it's a convenience only.  Give an example of what to do for more
flexibility.

Doc/lib/emailmessage.tex

index 61dc74b255a4b29c6b34761e00cd2a904bdcd180..f580edfc91206a80809981bb76baf7df6c196600 100644 (file)
@@ -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__}{}