aboutsummaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authorMark Sapiro <mark@msapiro.net>2013-12-01 13:22:52 -0800
committerMark Sapiro <mark@msapiro.net>2013-12-01 13:22:52 -0800
commitb03cc278ec35db41a04a3449f9e5689385819524 (patch)
treeda2c7d3179f752741a2a5f23d2499202f6fbefc3 /bin
parentf299ca620f3f5a8d2417f8779d3a208cdee1d3c5 (diff)
downloadmailman2-b03cc278ec35db41a04a3449f9e5689385819524.tar.gz
mailman2-b03cc278ec35db41a04a3449f9e5689385819524.tar.xz
mailman2-b03cc278ec35db41a04a3449f9e5689385819524.zip
Fixed a possible TypeError in bin/sync_members introduced in 2.1.17.
Diffstat (limited to 'bin')
-rwxr-xr-xbin/sync_members8
1 files changed, 6 insertions, 2 deletions
diff --git a/bin/sync_members b/bin/sync_members
index 58262841..0c860d25 100755
--- a/bin/sync_members
+++ b/bin/sync_members
@@ -257,7 +257,9 @@ def main():
if not dryrun:
mlist.ApprovedAddMember(userdesc, welcome, notifyadmin)
# Avoid UnicodeError if name can't be decoded
- name = unicode(name, errors='replace').encode(enc, 'replace')
+ if isinstance(name, str):
+ name = unicode(name, errors='replace')
+ name = name.encode(enc, 'replace')
s = email.Utils.formataddr((name, addr)).encode(enc, 'replace')
print _('Added : %(s)s')
except Errors.MMAlreadyAMember:
@@ -279,7 +281,9 @@ def main():
# get rid of this member's entry
mlist.removeMember(addr)
# Avoid UnicodeError if name can't be decoded
- name = unicode(name, errors='replace').encode(enc, 'replace')
+ if isinstance(name, str):
+ name = unicode(name, errors='replace')
+ name = name.encode(enc, 'replace')
s = email.Utils.formataddr((name, addr)).encode(enc, 'replace')
print _('Removed: %(s)s')