------------------------------------------------------------
revno: 1524
fixes bug: https://launchpad.net/bugs/1415406
committer: Mark Sapiro <m...@msapiro.net>
branch nick: 2.1
timestamp: Fri 2015-01-30 12:04:52 -0800
message:
  The admindb interface has been fixed so the the detail message body
  display doesn't lose part of a multi-byte character, and characters which
  are invalid in the message's charset are replaced rather than the whole
  body not being converted to the display charset.
modified:
  Mailman/Cgi/admindb.py
  NEWS


--
lp:mailman/2.1
https://code.launchpad.net/~mailman-coders/mailman/2.1

Your team Mailman Checkins is subscribed to branch lp:mailman/2.1.
To unsubscribe from this branch go to 
https://code.launchpad.net/~mailman-coders/mailman/2.1/+edit-subscription
=== modified file 'Mailman/Cgi/admindb.py'
--- Mailman/Cgi/admindb.py	2014-06-09 22:06:46 +0000
+++ Mailman/Cgi/admindb.py	2015-01-30 20:04:52 +0000
@@ -1,4 +1,4 @@
-# Copyright (C) 1998-2014 by the Free Software Foundation, Inc.
+# Copyright (C) 1998-2015 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
@@ -671,13 +671,11 @@
     for line in email.Iterators.body_line_iterator(msg, decode=True):
         lines.append(line)
         chars += len(line)
-        if chars > limit > 0:
+        if chars >= limit > 0:
             break
-    # Negative values mean display the entire message, regardless of size
-    if limit > 0:
-        body = EMPTYSTRING.join(lines)[:mm_cfg.ADMINDB_PAGE_TEXT_LIMIT]
-    else:
-        body = EMPTYSTRING.join(lines)
+    # We may have gone over the limit on the last line, but keep the full line
+    # anyway to avoid losing part of a multibyte character.
+    body = EMPTYSTRING.join(lines)
     # Get message charset and try encode in list charset
     # We get it from the first text part.
     # We need to replace invalid characters here or we can throw an uncaught
@@ -692,7 +690,7 @@
     lcset = Utils.GetCharSet(mlist.preferred_language)
     if mcset <> lcset:
         try:
-            body = unicode(body, mcset).encode(lcset, 'replace')
+            body = unicode(body, mcset, 'replace').encode(lcset, 'replace')
         except (LookupError, UnicodeError, ValueError):
             pass
     hdrtxt = NL.join(['%s: %s' % (k, v) for k, v in msg.items()])

=== modified file 'NEWS'
--- NEWS	2015-01-30 04:06:26 +0000
+++ NEWS	2015-01-30 20:04:52 +0000
@@ -5,7 +5,7 @@
 
 Here is a history of user visible changes to Mailman.
 
-2.2 Branch Backports (released in conjunction with 2.1.19rc1)
+2.2 Branch Backports (released in conjunction with 2.1.19)
 
   The following New Features and Bug Fixes have been in an "unofficial,
   never to be released" Mailman 2.2 branch for several years. Until now,
@@ -60,7 +60,7 @@
       archive to emphasize that even if you got to the message from a
       subject, date or author index, previous and next are still by thread.
 
-2.1.19rc1 (29-Jan-2015)
+2.1.19 (xx-xxx-2015)
 
   New Features
 
@@ -126,6 +126,11 @@
 
   Bug fixes and other patches
 
+    - The admindb interface has been fixed so the the detail message body
+      display doesn't lose part of a multi-byte character, and characters which
+      are invalid in the message's charset are replaced rather than the whole
+      body not being converted to the display charset.  (LP: #1415406)
+
     - Fixed a bug in bin/rmlist that would throw an exception or just fail to
       remove held message files for a list with regexp special characters in
       its name.  (LP:#1414864)

_______________________________________________
Mailman-checkins mailing list
Mailman-checkins@python.org
Unsubscribe: 
https://mail.python.org/mailman/options/mailman-checkins/archive%40jab.org

Reply via email to