diff options
author | tkikuchi <> | 2006-01-29 05:12:26 +0000 |
---|---|---|
committer | tkikuchi <> | 2006-01-29 05:12:26 +0000 |
commit | d29d50fa39e93dc4faeeb97ad18f3d60abe4b2e8 (patch) | |
tree | 73f8e820815f5ae5a7d7b386c86d79ec5fe4cabc | |
parent | aeaa447be7a74887c2b8264aea10172131672386 (diff) | |
download | mailman2-d29d50fa39e93dc4faeeb97ad18f3d60abe4b2e8.tar.gz mailman2-d29d50fa39e93dc4faeeb97ad18f3d60abe4b2e8.tar.xz mailman2-d29d50fa39e93dc4faeeb97ad18f3d60abe4b2e8.zip |
Back out Revision 2.18.2.19 patch for email.Message.set_payload() bug
because it is overwrapped in Mailman.Message.
Diffstat (limited to '')
-rw-r--r-- | Mailman/Archiver/HyperArch.py | 9 | ||||
-rw-r--r-- | Mailman/Archiver/pipermail.py | 7 | ||||
-rw-r--r-- | Mailman/Handlers/Decorate.py | 9 | ||||
-rw-r--r-- | Mailman/Handlers/Scrubber.py | 13 | ||||
-rw-r--r-- | Mailman/Handlers/ToArchive.py | 13 | ||||
-rw-r--r-- | Mailman/Handlers/ToDigest.py | 17 |
6 files changed, 15 insertions, 53 deletions
diff --git a/Mailman/Archiver/HyperArch.py b/Mailman/Archiver/HyperArch.py index bd3802bc..0245f21b 100644 --- a/Mailman/Archiver/HyperArch.py +++ b/Mailman/Archiver/HyperArch.py @@ -1,4 +1,4 @@ -# Copyright (C) 1998-2005 by the Free Software Foundation, Inc. +# Copyright (C) 1998-2006 by the Free Software Foundation, Inc. # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -304,12 +304,7 @@ class Article(pipermail.Article): if charset[0]=="'" and charset[-1]=="'": charset = charset[1:-1] try: - # Check Scrubber-munged payload - if message.get('x-mailman-scrubbed'): - decode = False - else: - decode = True - body = message.get_payload(decode=decode) + body = message.get_payload(decode=True) except binascii.Error: body = None if body and charset != Utils.GetCharSet(self._lang): diff --git a/Mailman/Archiver/pipermail.py b/Mailman/Archiver/pipermail.py index ec5abaff..49de805b 100644 --- a/Mailman/Archiver/pipermail.py +++ b/Mailman/Archiver/pipermail.py @@ -224,12 +224,7 @@ class Article: self.headers[i] = message[i] # Read the message body - # Check Scrubber-munged paylaod - if message.get('x-mailman-scrubbed'): - decode = False - else: - decode = True - s = StringIO(message.get_payload(decode=decode)\ + s = StringIO(message.get_payload(decode=True)\ or message.as_string().split('\n\n',1)[1]) self.body = s.readlines() diff --git a/Mailman/Handlers/Decorate.py b/Mailman/Handlers/Decorate.py index a5df4010..41db3950 100644 --- a/Mailman/Handlers/Decorate.py +++ b/Mailman/Handlers/Decorate.py @@ -1,4 +1,4 @@ -# Copyright (C) 1998-2005 by the Free Software Foundation, Inc. +# Copyright (C) 1998-2006 by the Free Software Foundation, Inc. # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -98,12 +98,7 @@ def process(mlist, msg, msgdata): uheader = unicode(header, lcset) ufooter = unicode(footer, lcset) try: - # First, check if the message was Scrubber-munged - if msg.get('x-mailman-scrubbed'): - decode = False - else: - decode = True - oldpayload = unicode(msg.get_payload(decode=decode), mcset) + oldpayload = unicode(msg.get_payload(decode=True), mcset) frontsep = endsep = u'' if header and not header.endswith('\n'): frontsep = u'\n' diff --git a/Mailman/Handlers/Scrubber.py b/Mailman/Handlers/Scrubber.py index a0c4896c..807e8cd6 100644 --- a/Mailman/Handlers/Scrubber.py +++ b/Mailman/Handlers/Scrubber.py @@ -1,4 +1,4 @@ -# Copyright (C) 2001-2005 by the Free Software Foundation, Inc. +# Copyright (C) 2001-2006 by the Free Software Foundation, Inc. # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -164,12 +164,10 @@ def calculate_attachments_dir(mlist, msg, msgdata): 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. + # message by a text (scrubbing). del msg['content-type'] del msg['content-transfer-encoding'] msg.set_payload(text, charset) - msg['X-Mailman-Scrubbed'] = 'Yes' @@ -344,12 +342,7 @@ Url : %(url)s text.append(_('Skipped content of type %(partctype)s\n')) continue try: - # Check if the part is replaced. - if part.get('x-mailman-scrubbed'): - decode = False - else: - decode = True - t = part.get_payload(decode=decode) + t = part.get_payload(decode=True) except binascii.Error: t = part.get_payload() # TK: get_content_charset() returns 'iso-2022-jp' for internally diff --git a/Mailman/Handlers/ToArchive.py b/Mailman/Handlers/ToArchive.py index 6deb0958..533f2012 100644 --- a/Mailman/Handlers/ToArchive.py +++ b/Mailman/Handlers/ToArchive.py @@ -1,4 +1,4 @@ -# Copyright (C) 1998-2005 by the Free Software Foundation, Inc. +# Copyright (C) 1998-2006 by the Free Software Foundation, Inc. # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -20,10 +20,7 @@ import time from cStringIO import StringIO -from email import message_from_string - from Mailman import mm_cfg -from Mailman import Message from Mailman.Queue.sbcache import get_switchboard @@ -40,10 +37,4 @@ def process(mlist, msg, msgdata): # Send the message to the archiver queue archq = get_switchboard(mm_cfg.ARCHQUEUE_DIR) # Send the message to the queue - if msg.get('x-mailman-scrubbed'): - # Clean Scrubber-munged message. - archmsg = message_from_string(msg.as_string(), Message.Message) - del archmsg['x-mailman-scrubbed'] - archq.enqueue(archmsg, msgdata) - else: - archq.enqueue(msg, msgdata) + archq.enqueue(msg, msgdata) diff --git a/Mailman/Handlers/ToDigest.py b/Mailman/Handlers/ToDigest.py index e796a874..d5f1622a 100644 --- a/Mailman/Handlers/ToDigest.py +++ b/Mailman/Handlers/ToDigest.py @@ -1,4 +1,4 @@ -# Copyright (C) 1998-2005 by the Free Software Foundation, Inc. +# Copyright (C) 1998-2006 by the Free Software Foundation, Inc. # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -32,7 +32,6 @@ import time from types import ListType from cStringIO import StringIO -from email import message_from_string from email.Parser import Parser from email.Generator import Generator from email.MIMEBase import MIMEBase @@ -333,14 +332,10 @@ def send_i18n_digests(mlist, mboxfp): uh = '\n\t'.join(uh.split('\n')) print >> plainmsg, uh print >> plainmsg - if msg.get('x-mailman-scrubbed'): - # It has successfully been scrubbed, so this should be string. - payload = msg.get_payload() - else: - # If decoded payload is empty, this may be multipart message. - # -- just stringfy it. - payload = msg.get_payload(decode=True) \ - or msg.as_string().split('\n\n',1)[1] + # If decoded payload is empty, this may be multipart message. + # -- just stringfy it. + payload = msg.get_payload(decode=True) \ + or msg.as_string().split('\n\n',1)[1] mcset = msg.get_content_charset('') if mcset and mcset <> lcset and mcset <> lcset_out: try: @@ -412,8 +407,6 @@ def send_i18n_digests(mlist, mboxfp): isdigest=True) # RFC 1153 rfc1153msg.set_payload(plainmsg.getvalue(), lcset) - # Re-generate it because set_payload() doesn't encode. :-( - rfc1153msg = message_from_string(rfc1153msg.as_string(), Message.Message) virginq.enqueue(rfc1153msg, recips=plainrecips, listname=mlist.internal_name(), |