------------------------------------------------------------
revno: 1362
committer: Mark Sapiro <m...@msapiro.net>
branch nick: 2.2
timestamp: Fri 2014-11-28 12:45:39 -0800
message:
  Fixed a UnicodeDecodeError that could occur in the web admin interface
  if 'text' valued attributes have unicode values.
modified:
  Mailman/htmlformat.py
  NEWS


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

Your team Mailman Checkins is subscribed to branch lp:mailman/2.2.
To unsubscribe from this branch go to 
https://code.launchpad.net/~mailman-coders/mailman/2.2/+edit-subscription
=== modified file 'Mailman/htmlformat.py'
--- Mailman/htmlformat.py	2014-06-09 22:07:53 +0000
+++ Mailman/htmlformat.py	2014-11-28 20:45:39 +0000
@@ -1,4 +1,4 @@
-# Copyright (C) 1998-2012 by the Free Software Foundation, Inc.
+# Copyright (C) 1998-2014 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
@@ -32,7 +32,7 @@
 
 from Mailman import mm_cfg
 from Mailman import Utils
-from Mailman.i18n import _
+from Mailman.i18n import _, get_translation
 
 from Mailman.CSRFcheck import csrf_token
 
@@ -441,6 +441,7 @@
         self.kws = kws
 
     def Format(self, indent=0):
+        charset = get_translation().charset() or 'us-ascii'
         output = ['<INPUT name="%s" type="%s" value="%s"' %
                   (self.name, self.type, self.value)]
         for item in self.kws.items():
@@ -448,7 +449,10 @@
         if self.checked:
             output.append('CHECKED')
         output.append('>')
-        return SPACE.join(output)
+        ret = SPACE.join(output)
+        if self.type == 'TEXT' and isinstance(ret, unicode):
+            ret = ret.encode(charset, 'replace')
+        return ret
 
 
 class SubmitButton(InputObj):
@@ -486,6 +490,7 @@
         self.readonly = readonly
 
     def Format(self, indent=0):
+        charset = get_translation().charset() or 'us-ascii'
         output = '<TEXTAREA NAME=%s' % self.name
         if self.rows:
             output += ' ROWS=%s' % self.rows
@@ -496,6 +501,8 @@
         if self.readonly:
             output += ' READONLY'
         output += '>%s</TEXTAREA>' % self.text
+        if isinstance(output, unicode):
+            output = output.encode(charset, 'replace')
         return output
 
 class FileUpload(InputObj):

=== modified file 'NEWS'
--- NEWS	2014-11-08 01:22:26 +0000
+++ NEWS	2014-11-28 20:45:39 +0000
@@ -77,6 +77,9 @@
 
   Bug fixes and other patches
 
+    - Fixed a UnicodeDecodeError that could occur in the web admin interface
+      if 'text' valued attributes have unicode values.  (LP: #1397170)
+
     - We now catch the NotAMemberError exception thrown if an authenticated
       unsubscribe is submitted from the user options page for a nonmember.
       (LP: #1390653)

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

Reply via email to