[Mailman-Developers] Scrubber mungs quoted-printable revisited.
Tokio Kikuchi
tkikuchi at is.kochi-u.ac.jp
Sun Jan 29 01:07:23 CET 2006
Hi Mark,
Mark Sapiro wrote:
> Recently, I looked in more detail at the actual set_payload() method in
> the email library and I have at least a vague understanding of the
> problem. The problem and my understanding are reported at
> <http://sourceforge.net/tracker/?func=detail&aid=1409455&group_id=5470&atid=105470>.
> I have suggested a patch there which I call a 'Hint at possible fix'.
> This patch could be applied in Scrubber.py.
>
It's nice that the problem was tracked down. Thank you!
> The patch to Scrubber.py would add to the end of the
>
> def replace_payload_by_text(msg, text, charset):
>
> definition making the whole definition
>
> def replace_payload_by_text(msg, text, charset):
> # TK: This is a common function in replacing the attachment and the
> main
> # message by a text (scrubbing). Also, add a flag indicating it
> has been
> # scrubbed.
> del msg['content-type']
> del msg['content-transfer-encoding']
> msg.set_payload(text, charset)
> msg['X-Mailman-Scrubbed'] = 'Yes'
> if msg.get('content-transfer-encoding') == 'quoted-printable':
> cset = msg.get_charset()
> if cset:
> msg._payload = cset.body_encode(msg._payload)
> msg._charset = None
>
I'm rather uneasy with _varname attribute is manupulated everywhere in
the application code. Maybe we should override the email.Message
behaviour by overriding in Mailman.Message. Also I will add 'base64' in
encoding check and back out the patches related to the 'X-Mailman-Scruber'.
>
> The advantage to doing this in Scrubber.py and unconditionally setting
> the decode flag for subsequent get_payload() calls is it makes the
> whole process insensitive to whether or not or when Python email bug #
> 1409455 is fixed. If the bug is fixed, the payload will be encoded and
> msg.get_charset() above will return None so the payload won't be
> encoded a second time. The additional code above can be removed at
> some point after we're sure the email library used by Mailman is fixed.
>
>
--
Tokio Kikuchi, tkikuchi@ is.kochi-u.ac.jp
http://weather.is.kochi-u.ac.jp/
More information about the Mailman-Developers
mailing list