[Python-Dev] Re: [Spambayes] mail.generator examples - anyone kknow where I can find them?

Skip Montanaro skip@pobox.com
Mon, 7 Jul 2003 14:56:46 -0500


python-list instead of python-dev would be a better place to post your
request.

    John> I've been trying to understand the email.generator class.  There
    John> are virtually NO examples showing how to "generate" an Email
    John> message.

You might try poking around the Mailman 2.1 source code for examples:

    % find . -name '*.py' | xargs egrep -i generator
    ./admin/www/MMGenerator.py:"""Generator for the Mailman on-line documentation.
    ./admin/www/MMGenerator.py:class MMGenerator(Skeleton, Sidebar, Banner):
    ./Mailman/Handlers/Scrubber.py:from email.Generator import Generator
    ./Mailman/Handlers/Scrubber.py:# We're using a subclass of the standard Generator because we want to suppress
    ./Mailman/Handlers/Scrubber.py:# sub-Generators will get created passing only mangle_from_ and maxheaderlen
    ./Mailman/Handlers/Scrubber.py:class ScrubberGenerator(Generator):
    ./Mailman/Handlers/Scrubber.py:        Generator.__init__(self, outfp, mangle_from_=0)
    ./Mailman/Handlers/Scrubber.py:            Generator._write_headers(self, msg)
    ./Mailman/Handlers/ToDigest.py:from email.Generator import Generator
    ./Mailman/Handlers/ToDigest.py:    g = Generator(mboxfp)
    ./Mailman/Handlers/ToDigest.py:        g = Generator(plainmsg)
    ./Mailman/ListAdmin.py:from email.Generator import Generator
    ./Mailman/ListAdmin.py:                g = Generator(fp)
    ./Mailman/ListAdmin.py:                g = Generator(outfp)
    ./Mailman/Mailbox.py:from email.Generator import Generator
    ./Mailman/Mailbox.py:        # Create a Generator instance to write the message to the file
    ./Mailman/Mailbox.py:        g = Generator(self.fp)

Skip