Package email :: Module generator :: Class Generator
[hide private]
[frames] | no frames]

_ClassType Generator

Known Subclasses:

Generates output from a Message object tree.

This basic generator writes the message to the given file object as plain text.

Instance Methods [hide private]
 
__init__(self, outfp, mangle_from_=True, maxheaderlen=78)
Create the generator for message flattening.
 
write(self, s)
 
flatten(self, msg, unixfrom=False)
Print the message object tree rooted at msg to the output file specified when the Generator instance was created.
 
clone(self, fp)
Clone this generator with the exact same options.
 
_write(self, msg)
 
_dispatch(self, msg)
 
_write_headers(self, msg)
 
_handle_text(self, msg)
 
_writeBody(self, msg)
 
_handle_multipart(self, msg)
 
_handle_message_delivery_status(self, msg)
 
_handle_message(self, msg)
Method Details [hide private]

__init__(self, outfp, mangle_from_=True, maxheaderlen=78)
(Constructor)

 

Create the generator for message flattening.

outfp is the output file-like object for writing the message to. It must have a write() method.

Optional mangle_from_ is a flag that, when True (the default), escapes From_ lines in the body of the message by putting a `>' in front of them.

Optional maxheaderlen specifies the longest length for a non-continued header. When a header line is longer (in characters, with tabs expanded to 8 spaces) than maxheaderlen, the header will split as defined in the Header class. Set maxheaderlen to zero to disable header wrapping. The default is 78, as recommended (but not required) by RFC 2822.

flatten(self, msg, unixfrom=False)

 

Print the message object tree rooted at msg to the output file specified when the Generator instance was created.

unixfrom is a flag that forces the printing of a Unix From_ delimiter before the first object in the message tree. If the original message has no From_ delimiter, a `standard' one is crafted. By default, this is False to inhibit the printing of any From_ delimiter.

Note that for subobjects, no From_ line is printed.