Revision: 8215
          http://svn.sourceforge.net/mailman/?rev=8215&view=rev
Author:   bwarsaw
Date:     2007-05-09 20:59:31 -0700 (Wed, 09 May 2007)

Log Message:
-----------
Forward port more of Mark's r8204 fixes:

- Handlers/Scrubber.py
   Fixed a scrubber issue where the i18n translated 'next part' separator
   can be garbled if the list charset is different from the message.

Note that the other parts of the Scrubber.py and Decorate.py changes in r8204
have already been applied to the trunk.

Modified Paths:
--------------
    branches/exp-elixir-branch/Mailman/Handlers/Scrubber.py

Modified: branches/exp-elixir-branch/Mailman/Handlers/Scrubber.py
===================================================================
--- branches/exp-elixir-branch/Mailman/Handlers/Scrubber.py     2007-05-10 
03:08:48 UTC (rev 8214)
+++ branches/exp-elixir-branch/Mailman/Handlers/Scrubber.py     2007-05-10 
03:59:31 UTC (rev 8215)
@@ -174,7 +174,19 @@
         if ctype == 'text/plain':
             # We need to choose a charset for the scrubbed message, so we'll
             # arbitrarily pick the charset of the first text/plain part in the
-            # message.  Also get the RFC 3676 stuff from this part.
+            # message.
+            #
+            # Also get the RFC 3676 stuff from this part. This seems to
+            # work okay for scrub_nondigest.  It will also work as far as
+            # scrubbing messages for the archive is concerned, but Pipermail
+            # doesn't pay any attention to the RFC 3676 parameters.  The plain
+            # format digest is going to be a disaster in any case as some of
+            # messages will be format="flowed" and some not.  ToDigest creates
+            # its own Content-Type: header for the plain digest which won't
+            # have RFC 3676 parameters. If the message Content-Type: headers
+            # are retained for display in the digest, the parameters will be
+            # there for information, but not for the MUA. This is the best we
+            # can do without having get_payload() process the parameters.
             if charset is None:
                 charset = part.get_content_charset(lcset)
                 format = part.get_param('format')
@@ -331,6 +343,13 @@
                 charsets.append(partcharset)
         # Now join the text and set the payload
         sep = _('-------------- next part --------------\n')
+        # The i18n separator is in the list's charset. Coerce it to the
+        # message charset.
+        try:
+            s = unicode(sep, lcset, 'replace')
+            sep = s.encode(charset, 'replace')
+        except (UnicodeError, LookupError, ValueError):
+            pass
         rept = sep.join(text)
         # Replace entire message with text and scrubbed notice.
         # Try with message charsets and utf-8


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.
_______________________________________________
Mailman-checkins mailing list
[email protected]
Unsubscribe: 
http://mail.python.org/mailman/options/mailman-checkins/archive%40jab.org

Reply via email to