diff options
author | bwarsaw <> | 2004-02-29 04:25:31 +0000 |
---|---|---|
committer | bwarsaw <> | 2004-02-29 04:25:31 +0000 |
commit | 1e2df627a366503d62a48121a7a499761b907bcf (patch) | |
tree | 32baacbd52b76fb40e381a615ee68c3298628474 /Mailman | |
parent | d4f91193d3575433412facf75628388a3e82c177 (diff) | |
download | mailman2-1e2df627a366503d62a48121a7a499761b907bcf.tar.gz mailman2-1e2df627a366503d62a48121a7a499761b907bcf.tar.xz mailman2-1e2df627a366503d62a48121a7a499761b907bcf.zip |
__repr__(): Watch out for Unicode fullname or password.
Diffstat (limited to '')
-rw-r--r-- | Mailman/UserDesc.py | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/Mailman/UserDesc.py b/Mailman/UserDesc.py index aa06639f..987279f6 100644 --- a/Mailman/UserDesc.py +++ b/Mailman/UserDesc.py @@ -1,21 +1,26 @@ -# Copyright (C) 2001,2002 by the Free Software Foundation, Inc. +# Copyright (C) 2001-2004 by the Free Software Foundation, Inc. # # This program is free software; you can redistribute it and/or # 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. """User description class/structure, for ApprovedAddMember and friends.""" + +from types import UnicodeType + + + class UserDesc: def __init__(self, address=None, fullname=None, password=None, digest=None, lang=None): @@ -53,5 +58,10 @@ class UserDesc: elif digest == 1: digest = 'yes' language = getattr(self, 'language', 'n/a') + # Make sure fullname and password are encoded if they're strings + if isinstance(fullname, UnicodeType): + fullname = fullname.encode('ascii', 'replace') + if isinstance(password, UnicodeType): + password = password.encode('ascii', 'replace') return '<UserDesc %s (%s) [%s] [digest? %s] [%s]>' % ( address, fullname, password, digest, language) |