[Mailman-Users] Mailman 2.1.18 final release

Mark Sapiro mark at msapiro.net
Tue May 6 08:11:38 CEST 2014


On 05/03/2014 11:30 AM, Mark Sapiro wrote:
> I'm pleased to announce the final release for Mailman 2.1.18.


It appears that the from_is_list and dmarc_moderation_actions Wrap
Message actions may run afoul of this issue
<http://bugs.python.org/issue7970> in the Python email library in
versions older than 2.6.x where x is some number < 5. I.e. I know the
bug is fixed in Python 2.7 and 2.6.5 and not in any 2.5.x or older. I'm
not sure about 2.6.1 - 2.6.4.

I have attached a patch to Mailman/Message.py which I think will fix
this issue if you have it. You will know if you do because all outgoing
mail will be shunted with the exception "TypeError: Expected list, got
<type 'str'>" when SMTPDirect.py invokes the as_string() method on the
message object.

I think this will only occur with those older Pythons and when a Wrap
Message action is applied.

As soon as I get confirmation from the original reporter that the patch
solves the problem, I will release a fixed version.

-- 
Mark Sapiro <mark at msapiro.net>        The highway is for gamblers,
San Francisco Bay Area, California    better use your sense - B. Dylan
-------------- next part --------------
--- /var/MM/2.1/Mailman/Message.py	2014-04-26 21:29:42.282766984 -0700
+++ /var/MM/21/Mailman/Message.py	2014-05-05 22:40:32.412348756 -0700
@@ -59,6 +59,25 @@
         return self.__class__(fp, self._mangle_from_,
                 self.__children_maxheaderlen, self.__children_maxheaderlen)
 
+    # This is the _handle_message method with the fix for bug 7970.
+    def _handle_message(self, msg):
+        s = StringIO()
+        g = self.clone(s)
+        # The payload of a message/rfc822 part should be a multipart sequence
+        # of length 1.  The zeroth element of the list should be the Message
+        # object for the subpart.  Extract that object, stringify it, and
+        # write it out.
+        # Except, it turns out, when it's a string instead, which happens when
+        # and only when HeaderParser is used on a message of mime type
+        # message/rfc822.  Such messages are generated by, for example,
+        # Groupwise when forwarding unadorned messages.  (Issue 7970.)  So
+        # in that case we just emit the string body.
+        payload = msg.get_payload()
+        if isinstance(payload, list):
+            g.flatten(msg.get_payload(0), unixfrom=False)
+            payload = s.getvalue()
+        self._fp.write(payload)
+
 
 

 class Message(email.Message.Message):
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: OpenPGP digital signature
URL: <http://mail.python.org/pipermail/mailman-users/attachments/20140505/130222ae/attachment-0001.sig>


More information about the Mailman-Users mailing list