Update of /cvsroot/mailman/mailman/cron
In directory sc8-pr-cvs1:/tmp/cvs-serv32179
Modified Files:
mailpasswds
Log Message:
tounicode(): New function to coerce to unicode after the fact (yes,
this is a hack, everything should be turned into unicode at the edges
-- sigh, that's a mm3 solution).
main(): Some fixes for i18n, based on debugging w/Peer. Specifically
coerce table entries to unicode to catch non-ascii passwords (didn't
think about that! :). Also, turn the template into unicode so it
combines properly with other texts.
Closes SF 755190.
Back port candidate.
Index: mailpasswds
===================================================================
RCS file: /cvsroot/mailman/mailman/cron/mailpasswds,v
retrieving revision 2.16
retrieving revision 2.17
diff -u -d -r2.16 -r2.17
--- mailpasswds 2 May 2003 03:45:31 -0000 2.16
+++ mailpasswds 19 Jun 2003 21:49:17 -0000 2.17
@@ -42,6 +42,7 @@
import os
import errno
import getopt
+from types import UnicodeType
import paths
# mm_cfg must be imported before the other modules, due to the side-effect of
@@ -78,6 +79,13 @@
+def tounicode(s, enc):
+ if isinstance(s, UnicodeType):
+ return s
+ return unicode(s, enc, 'replace')
+
+
+
def main():
try:
opts, args = getopt.getopt(sys.argv[1:], 'l:h',
@@ -184,6 +192,7 @@
if cnt > langcnt:
poplang = lang
langcnt = cnt
+ enc = Utils.GetCharSet(poplang)
# Craft the table header
header = '%-40s %-10s\n%-40s %-10s' % (
_('List'), _('Password // URL'), '----', '--------')
@@ -198,6 +207,9 @@
'exreq' : sitereq,
'owner' : siteowner,
}, lang=poplang)
+ # Coerce everything to Unicode
+ text = tounicode(text, enc)
+ table = [tounicode(_t, enc) for _t in table]
# Add the table to the end so it doesn't get wrapped/filled
text += (header + '\n' + NL.join(table))
# Translate the message and headers to user's suggested lang
_______________________________________________
Mailman-checkins mailing list
[EMAIL PROTECTED]
http://mail.python.org/mailman/listinfo/mailman-checkins