[Repoze-checkins] r998 - in repoze.who/trunk: . repoze/who repoze/who/plugins
Chris McDonough
chrism at agendaless.com
Wed May 7 19:29:18 EDT 2008
Author: Chris McDonough <chrism at agendaless.com>
Date: Wed May 7 19:29:18 2008
New Revision: 998
Log:
- Fix bug found by Chris Perkins: the auth_tkt plugin's "remember"
method didn't handle userids which are Python "long" instances
properly. Symptom: TypeError: cannot concatenate 'str' and 'long'
objects in "paste.auth.auth_tkt".
Modified:
repoze.who/trunk/CHANGES.txt
repoze.who/trunk/repoze/who/plugins/auth_tkt.py
repoze.who/trunk/repoze/who/tests.py
Modified: repoze.who/trunk/CHANGES.txt
==============================================================================
--- repoze.who/trunk/CHANGES.txt (original)
+++ repoze.who/trunk/CHANGES.txt Wed May 7 19:29:18 2008
@@ -3,6 +3,11 @@
After 1.0.1
+ - Fix bug found by Chris Perkins: the auth_tkt plugin's "remember"
+ method didn't handle userids which are Python "long" instances
+ properly. Symptom: TypeError: cannot concatenate 'str' and 'long'
+ objects in "paste.auth.auth_tkt".
+
- Added predicate-based "restriction" middleware support
(repoze.who.restrict), allowing configuratio-driven authorization
as a WSGI filter. One example predicate, 'authenticated_predicate',
Modified: repoze.who/trunk/repoze/who/plugins/auth_tkt.py
==============================================================================
--- repoze.who/trunk/repoze/who/plugins/auth_tkt.py (original)
+++ repoze.who/trunk/repoze/who/plugins/auth_tkt.py Wed May 7 19:29:18 2008
@@ -15,6 +15,7 @@
userid_type_encoders = {
int: ('int', str),
+ long: ('int', str),
}
def __init__(self, secret, cookie_name='auth_tkt',
Modified: repoze.who/trunk/repoze/who/tests.py
==============================================================================
--- repoze.who/trunk/repoze/who/tests.py (original)
+++ repoze.who/trunk/repoze/who/tests.py Wed May 7 19:29:18 2008
@@ -1494,6 +1494,17 @@
expected = 'auth_tkt=%s; Path=/;' % new_val
self.assertEqual(result, [('Set-Cookie', expected)])
+ def test_remember_creds_different_long_userid(self):
+ plugin = self._makeOne('secret')
+ old_val = self._makeTicket(userid='userid')
+ environ = self._makeEnviron({'HTTP_COOKIE':'auth_tkt=%s' % old_val})
+ new_val = self._makeTicket(userid='1', userdata='userid_type:int')
+ result = plugin.remember(environ, {'repoze.who.userid':long(1),
+ 'userdata':''})
+
+ expected = 'auth_tkt=%s; Path=/;' % new_val
+ self.assertEqual(result, [('Set-Cookie', expected)])
+
def test_remember_creds_different_unicode_userid(self):
plugin = self._makeOne('secret')
old_val = self._makeTicket(userid='userid')
More information about the Repoze-checkins
mailing list