diff options
| author | bwarsaw | 2003-06-19 21:49:17 +0000 |
|---|---|---|
| committer | bwarsaw | 2003-06-19 21:49:17 +0000 |
| commit | 06184f741e32829cfe565e1be298ad2b17814ef8 (patch) | |
| tree | 5cb1709ed900be78b217e4904df156a741e5760c /cron | |
| parent | 010b9a2d388b668841c64c39881786b60275b4b8 (diff) | |
| download | mailman-06184f741e32829cfe565e1be298ad2b17814ef8.tar.gz mailman-06184f741e32829cfe565e1be298ad2b17814ef8.tar.zst mailman-06184f741e32829cfe565e1be298ad2b17814ef8.zip | |
Diffstat (limited to 'cron')
| -rwxr-xr-x | cron/mailpasswds | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/cron/mailpasswds b/cron/mailpasswds index 88bb624d9..86f49d18e 100755 --- a/cron/mailpasswds +++ b/cron/mailpasswds @@ -42,6 +42,7 @@ import sys 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 usage(code, msg=''): +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 @@ def main(): 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 @@ def main(): '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 |
