From b03cc278ec35db41a04a3449f9e5689385819524 Mon Sep 17 00:00:00 2001 From: Mark Sapiro Date: Sun, 1 Dec 2013 13:22:52 -0800 Subject: Fixed a possible TypeError in bin/sync_members introduced in 2.1.17. --- bin/sync_members | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'bin') 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') -- cgit v1.2.3