------------------------------------------------------------ revno: 1684 fixes bug: https://launchpad.net/bugs/1644356 committer: Mark Sapiro <m...@msapiro.net> branch nick: 2.1 timestamp: Wed 2016-11-23 13:27:00 -0800 message: Fixed UnicodeError in sending digests following changing list's preferred_language. modified: Mailman/Handlers/ToDigest.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/Handlers/ToDigest.py' --- Mailman/Handlers/ToDigest.py 2013-03-11 03:27:18 +0000 +++ Mailman/Handlers/ToDigest.py 2016-11-23 21:27:00 +0000 @@ -1,4 +1,4 @@ -# Copyright (C) 1998-2013 by the Free Software Foundation, Inc. +# Copyright (C) 1998-2016 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 @@ -68,6 +68,17 @@ +def to_cset_out(text, lcset): + # Convert text from unicode or lcset to output cset. + ocset = Charset(lcset).get_output_charset() or lcset + if isinstance(text, unicode): + return text.encode(ocset, errors='replace') + else: + return text.decode(lcset, errors='replace').encode(ocset, + errors='replace') + + + def process(mlist, msg, msgdata): # Short circuit non-digestable lists. if not mlist.digestable or msgdata.get('isdigest'): @@ -299,7 +310,7 @@ if msgcount == 0: # Why did we even get here? return - toctext = toc.getvalue() + toctext = to_cset_out(toc.getvalue(), lcset) # MIME tocpart = MIMEText(toctext, _charset=lcset) tocpart['Content-Description']= _("Today's Topics (%(msgcount)d messages)") @@ -412,7 +423,7 @@ listname=mlist.internal_name(), isdigest=True) # RFC 1153 - rfc1153msg.set_payload(plainmsg.getvalue(), lcset) + rfc1153msg.set_payload(to_cset_out(plainmsg.getvalue(), lcset), lcset) virginq.enqueue(rfc1153msg, recips=plainrecips, listname=mlist.internal_name(), === modified file 'NEWS' --- NEWS 2016-11-16 23:27:10 +0000 +++ NEWS 2016-11-23 21:27:00 +0000 @@ -23,6 +23,9 @@ Bug fixes and other patches + - Fixed an issue causing UnicodeError in sending digests following a + change of a list's preferred_language. (LP: #1644356) + - Enhanced the fix for race conditions in MailList().Load(). (LP: #266464) - Fixed a typo in Utils.py that could have resulted in a NameError in
_______________________________________________ Mailman-checkins mailing list Mailman-checkins@python.org Unsubscribe: https://mail.python.org/mailman/options/mailman-checkins/archive%40jab.org