aboutsummaryrefslogtreecommitdiffstats
path: root/cron/mailpasswds
diff options
context:
space:
mode:
authorbwarsaw <>2003-09-22 02:29:51 +0000
committerbwarsaw <>2003-09-22 02:29:51 +0000
commit33ad4402b372695b9526f57c33dd8f05c0eeddb3 (patch)
tree22a731818f773f8bf4828a333f452049f1b04d82 /cron/mailpasswds
parentc6e5c888e2cfc4829e02badf397d2b85b3f39f74 (diff)
downloadmailman2-33ad4402b372695b9526f57c33dd8f05c0eeddb3.tar.gz
mailman2-33ad4402b372695b9526f57c33dd8f05c0eeddb3.tar.xz
mailman2-33ad4402b372695b9526f57c33dd8f05c0eeddb3.zip
Backporting from the HEAD -- bin and cron scripts
Diffstat (limited to '')
-rwxr-xr-xcron/mailpasswds22
1 files changed, 21 insertions, 1 deletions
diff --git a/cron/mailpasswds b/cron/mailpasswds
index 348ca336..86f49d18 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',
@@ -142,7 +150,15 @@ def main():
continue
# Group by the lower-cased address, since Mailman always
# treates person@dom.ain the same as PERSON@dom.ain.
- password = mlist.getMemberPassword(member)
+ try:
+ password = mlist.getMemberPassword(member)
+ except Errors.NotAMemberError:
+ # Here's a member with no passwords, which I think was
+ # possible in older versions of Mailman. Log this and
+ # move on.
+ syslog('error', 'password-less member %s for list %s',
+ member, mlist.internal_name())
+ continue
optionsurl = mlist.GetOptionsURL(member)
lang = mlist.getMemberLanguage(member)
info = (listaddr, password, optionsurl, lang)
@@ -176,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'), '----', '--------')
@@ -190,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