Update of /cvsroot/mailman/mailman/Mailman
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11643
Modified Files:
Tag: Release_2_1-maint
UserDesc.py
Log Message:
__repr__(): Watch out for Unicode fullname or password.
Index: UserDesc.py
===================================================================
RCS file: /cvsroot/mailman/mailman/Mailman/UserDesc.py,v
retrieving revision 2.2
retrieving revision 2.2.2.1
diff -u -d -r2.2 -r2.2.2.1
--- UserDesc.py 16 Mar 2002 06:57:36 -0000 2.2
+++ UserDesc.py 29 Feb 2004 04:25:31 -0000 2.2.2.1
@@ -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 @@
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)
_______________________________________________
Mailman-checkins mailing list
[EMAIL PROTECTED]
Unsubscribe: http://mail.python.org/mailman/options/mailman-checkins/archive%40jab.org