diff options
| author | bwarsaw | 2002-12-02 14:45:53 +0000 |
|---|---|---|
| committer | bwarsaw | 2002-12-02 14:45:53 +0000 |
| commit | 70aa0634254f63b6f4f6b003338186655b11ae5b (patch) | |
| tree | e3c0057d487309a3b596040d5833b1a93c890b4b | |
| parent | d7ce415188020cfcedc79bcbff29b0da1bd37615 (diff) | |
| download | mailman-70aa0634254f63b6f4f6b003338186655b11ae5b.tar.gz mailman-70aa0634254f63b6f4f6b003338186655b11ae5b.tar.zst mailman-70aa0634254f63b6f4f6b003338186655b11ae5b.zip | |
main(): This should fix problems when printing list members with
"funny" characters in their names. We coerce the output to the
default encoding, although I'm not 100% sure this is the right thing
to do. (Works for me.)
Also, MMNoSuchUserError -> NotAMemberError
| -rwxr-xr-x | bin/sync_members | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/bin/sync_members b/bin/sync_members index e9e23daed..1bf9a4549 100755 --- a/bin/sync_members +++ b/bin/sync_members @@ -6,14 +6,14 @@ # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 2 # of the License, or (at your option) any later version. -# +# # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -# +# # You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software +# along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. """Synchronize a mailing list's membership with a flat file. @@ -177,7 +177,7 @@ def main(): except IndexError: usage(1, _('No listname given')) break - + if listname is None or filename is None: usage(1, _('Must have a listname and a filename')) @@ -255,24 +255,27 @@ def main(): try: if not dryrun: mlist.ApprovedAddMember(userdesc, welcome, notifyadmin) - print _('Added : <%(addr)30s> %(name)s') + s = email.Utils.formataddr((name, addr)).encode(enc, 'replace') + print _('Added : %(s)s') except Errors.MMAlreadyAMember: pass for laddr, addr in addrs.items(): - name = mlist.getMemberName(laddr) or '' - # should be a member, otherwise our test above is broken + # Should be a member, otherwise our test above is broken if not dryrun: try: mlist.ApprovedDeleteMember(addr, admin_notif=notifyadmin, userack=goodbye) - except Errors.MMNoSuchUserError: + except Errors.NotAMemberError: # This can happen if the address is illegal (i.e. can't be # parsed by email.Utils.parseaddr()) but for legacy # reasons is in the database. Use a lower level remove to # get rid of this member's entry mlist.removeMember(addr) - print _('Removed: <%(addr)30s> %(name)s') + name = mlist.getMemberName(laddr) or '' + enc = sys.getdefaultencoding() + s = email.Utils.formataddr((name, addr)).encode(enc, 'replace') + print _('Removed: %(s)s') mlist.Save() finally: |
