aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortkikuchi <>2006-01-29 05:05:19 +0000
committertkikuchi <>2006-01-29 05:05:19 +0000
commitaeaa447be7a74887c2b8264aea10172131672386 (patch)
treedca5de4f6f16dbee3ccb72f6a05bba24e906f19a
parent1021d3f326d39a2e3336c8340911c9308d7a6ff0 (diff)
downloadmailman2-aeaa447be7a74887c2b8264aea10172131672386.tar.gz
mailman2-aeaa447be7a74887c2b8264aea10172131672386.tar.xz
mailman2-aeaa447be7a74887c2b8264aea10172131672386.zip
Wrapping set_payload() to encode contents into qp/base64 upon setting.
This incorporates Python email patch: http://sourceforge.net/tracker/?func=detail&aid=1409455&group_id=5470&atid=105470 and eventually be backed out if email package is updated.
-rw-r--r--Mailman/Message.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/Mailman/Message.py b/Mailman/Message.py
index 4a0d7c7c..bdf7e718 100644
--- a/Mailman/Message.py
+++ b/Mailman/Message.py
@@ -199,6 +199,17 @@ class Message(email.Message.Message):
except (UnicodeError, LookupError, ValueError):
return failobj
+ def set_payload(self, payload, charset=None):
+ """Set the payload to the given value (Override email package).
+ Payload is converted to a MIME message body when this is called.
+ """
+ email.Message.Message.set_payload(self, payload, charset)
+ if self.get('content-transfer-encoding') in \
+ ('quoted-printable', 'base64'):
+ cset = self.get_charset()
+ if cset:
+ self._payload = cset.body_encode(self._payload)
+ self._charset = None
class UserNotification(Message):