[Checkins] SVN: z3c.authenticator/branches/0.6.2/ backport r110354 from svn://svn.zope.org/repos/main/z3c.authenticator/trunk
Adam Groszer
agroszer at gmail.com
Wed Mar 31 04:07:29 EDT 2010
Log message for revision 110355:
backport r110354 from svn://svn.zope.org/repos/main/z3c.authenticator/trunk
Changed:
U z3c.authenticator/branches/0.6.2/CHANGES.txt
U z3c.authenticator/branches/0.6.2/src/z3c/authenticator/README.txt
U z3c.authenticator/branches/0.6.2/src/z3c/authenticator/user.py
-=-
Modified: z3c.authenticator/branches/0.6.2/CHANGES.txt
===================================================================
--- z3c.authenticator/branches/0.6.2/CHANGES.txt 2010-03-31 07:58:34 UTC (rev 110354)
+++ z3c.authenticator/branches/0.6.2/CHANGES.txt 2010-03-31 08:07:28 UTC (rev 110355)
@@ -2,6 +2,11 @@
CHANGES
=======
+0.6.3 (2010-03-31)
+------------------
+
+- Bugfix: Did not handle unicode IUser.login values.
+
0.6.2 (2010-01-26)
------------------
Modified: z3c.authenticator/branches/0.6.2/src/z3c/authenticator/README.txt
===================================================================
--- z3c.authenticator/branches/0.6.2/src/z3c/authenticator/README.txt 2010-03-31 07:58:34 UTC (rev 110354)
+++ z3c.authenticator/branches/0.6.2/src/z3c/authenticator/README.txt 2010-03-31 08:07:28 UTC (rev 110355)
@@ -481,3 +481,15 @@
>>> authenticated.email
u'max at foobar.com'
+
+
+Edge cases
+----------
+
+We can have Users with unicode login, as we allow this with TextLine in IUser.
+
+ >>> p = User(u'bob'+unichr(233), 'password', 'title')
+
+Adding it should not fail:
+
+ >>> uid, user = authPlugin.add(p)
Modified: z3c.authenticator/branches/0.6.2/src/z3c/authenticator/user.py
===================================================================
--- z3c.authenticator/branches/0.6.2/src/z3c/authenticator/user.py 2010-03-31 07:58:34 UTC (rev 110354)
+++ z3c.authenticator/branches/0.6.2/src/z3c/authenticator/user.py 2010-03-31 08:07:28 UTC (rev 110355)
@@ -31,15 +31,19 @@
# get the IP addresss only once
try:
- ip = socket.getaddrinfo(socket.gethostname(), 0)[-1][-1][0]
+ ip = socket.getaddrinfo(socket.gethostname(), 0)[-1][-1][0]
except:
- ip = '127.0.0.1'
+ ip = '127.0.0.1'
def generateUserIDToken(id):
"""Generates a unique user id token."""
t = long(time.time() * 1000)
r = long(random.random()*100000000000000000L)
- data = str(ip)+' '+str(t)+' '+str(r)+' '+str(id)
+ try:
+ id = str(id)
+ except UnicodeEncodeError:
+ id = id.encode('utf-8')
+ data = str(ip)+' '+str(t)+' '+str(r)+' '+id
return unicode(md5.md5(data).hexdigest())
More information about the checkins
mailing list