Question about specific place of source code
![](https://secure.gravatar.com/avatar/4832deca0d706b10f3c485414bd8c206.jpg?s=120&d=mm&r=g)
Hi all,
i am using mailman 2.1.9. I am making some customizations, and i have a questions about MIME Content-Type.
(I have crawled through the archives...)
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.
Any urgent help would be greatly appreciated.
Thanks so far, L.R.
![](https://secure.gravatar.com/avatar/56f108518d7ee2544412cc80978e3182.jpg?s=120&d=mm&r=g)
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@msapiro.net> The highway is for gamblers, San Francisco Bay Area, California better use your sense - B. Dylan
participants (2)
-
Lars Reimann
-
Mark Sapiro