[Mailman-Developers] Question about specific place of source code

Mark Sapiro mark at msapiro.net
Sat Mar 15 15:54:12 CET 2008


Lars Reimann wrote:
>
>If I add a message header (msg_header and msg_footer) mailman sets the
>
>> Content-Type: text/plain; charset="us-ascii"
>
>My Question is, if anyone can please point me to the line of code,
>where this is added to a message. I already looked in Decorate.py but
>my alterations (e.g. comment out the header addition) did not make any
>difference. So the place where i looked might not be correct.
>
>I want to see how these are constructed and maybe alter to fit my
>customization.


The addition of headers and footers is done by Decorate.py. When they
are added as separate MIME parts, the parts are constructed by
email.MIMEText.MIMEText() which is called in four places in
Decorate.py.

If you are asking about the case where the message is a single
text/plain part and the header and/or footer are added to that part.
The overall message Content-Type: is set by

            del msg['content-transfer-encoding']
            del msg['content-type']
            msg.set_payload(payload, newcset)

It is the email.Message.Message.set_payload() method that actually sets
the Content-Type: and Content-Transfer-Encoding: appropriate to the
payload (message body) being set.
-- 
Mark Sapiro <mark at msapiro.net>        The highway is for gamblers,
San Francisco Bay Area, California    better use your sense - B. Dylan



More information about the Mailman-Developers mailing list