[Mailman-Developers] [PATCH] Always add footer for us-ascii lists

Ben Gertzfield che@debian.org
Fri, 08 Mar 2002 12:39:00 +0900


This patch solves Dan Mick's problem where people posting with
the charset iso-8859-1 or utf-8 were not having the footer added
to the list, which was set to use us-ascii.

Since all the charsets we support are strictly supersets of us-ascii,
I think it's always safe to add the footer to plain text messages of
any charset when the list's charset is us-ascii. (No, UTF-16 will not
be supported with this change. But it wouldn't have been supported
with the old system anyway..)

Tested patch follows, against Mailman CVS.

-- 
Brought to you by the letters P and I and the number 11.
"You have my pills!"
Debian GNU/Linux maintainer of Gimp and Nethack -- http://www.debian.org/

Index: Decorate.py
===================================================================
RCS file: /cvsroot/mailman/mailman/Mailman/Handlers/Decorate.py,v
retrieving revision 2.10
diff -u -r2.10 Decorate.py
--- Decorate.py	23 Feb 2002 06:46:16 -0000	2.10
+++ Decorate.py	8 Mar 2002 01:44:35 -0000
@@ -61,12 +61,18 @@
     # matches the charset of the list's preferred language.  This is a
     # suboptimal solution, and should be solved by allowing a list to have
     # multiple headers/footers, for each language the list supports.
+    #
+    # Also, if the list's preferred charset is us-ascii, we can always
+    # safely add the header/footer to a plain text message since all
+    # charsets Mailman supports are strict supersets of us-ascii --
+    # no, UTF-16 emails are not supported yet.
     mcset = msg.get_param('charset', 'us-ascii')
     lcset = Utils.GetCharSet(mlist.preferred_language)
     msgtype = msg.get_type('text/plain')
     # BAW: If the charsets don't match, should we add the header and footer by
     # MIME multipart chroming the message?
-    if not msg.is_multipart() and msgtype == 'text/plain' and mcset == lcset:
+    if (not msg.is_multipart() and msgtype == 'text/plain' and
+        (lcset == 'us-ascii' or mcset == lcset)):
         payload = header + msg.get_payload() + footer
         msg.set_payload(payload)
     elif msg.get_type() == 'multipart/mixed':