diff options
| author | Chris McDonough <chrism@plope.com> | 2011-10-11 07:38:24 -0400 |
|---|---|---|
| committer | Chris McDonough <chrism@plope.com> | 2011-10-11 07:38:24 -0400 |
| commit | aeb144cf296c2e682cc78ff7afa4fc52baf3ca99 (patch) | |
| tree | 79e9b28c419f385b312e3858514d43e9ca381804 | |
| parent | c5724cb393b3de6facfe8a587a53a4dafeeb74c6 (diff) | |
| parent | c3c0bea60cbb543a75fd4f18334a8d99def65d15 (diff) | |
| download | pyramid-aeb144cf296c2e682cc78ff7afa4fc52baf3ca99.tar.gz pyramid-aeb144cf296c2e682cc78ff7afa4fc52baf3ca99.tar.bz2 pyramid-aeb144cf296c2e682cc78ff7afa4fc52baf3ca99.zip | |
Merge branch 'master' of https://github.com/jinty/pyramid into jinty-master
| -rw-r--r-- | pyramid/authentication.py | 5 | ||||
| -rw-r--r-- | pyramid/tests/test_authentication.py | 6 |
2 files changed, 8 insertions, 3 deletions
diff --git a/pyramid/authentication.py b/pyramid/authentication.py index 245a9692f..d17117055 100644 --- a/pyramid/authentication.py +++ b/pyramid/authentication.py @@ -726,7 +726,8 @@ class AuthTktCookieHelper(object): encoding, encoder = encoding_data userid = encoder(userid) user_data = 'userid_type:%s' % encoding - + + new_tokens = [] for token in tokens: if isinstance(token, text_type): try: @@ -735,6 +736,8 @@ class AuthTktCookieHelper(object): raise ValueError("Invalid token %r" % (token,)) if not (isinstance(token, str) and VALID_TOKEN.match(token)): raise ValueError("Invalid token %r" % (token,)) + new_tokens.append(token) + tokens = tuple(new_tokens) if hasattr(request, '_authtkt_reissued'): request._authtkt_reissue_revoked = True diff --git a/pyramid/tests/test_authentication.py b/pyramid/tests/test_authentication.py index 6bf14e76c..c7ae407ce 100644 --- a/pyramid/tests/test_authentication.py +++ b/pyramid/tests/test_authentication.py @@ -703,7 +703,7 @@ class TestAuthTktCookieHelper(unittest.TestCase): request.callbacks[0](None, response) self.assertEqual(len(response.headerlist), 3) self.assertEqual(response.headerlist[0][0], 'Set-Cookie') - self.assertTrue("'tokens': []" in response.headerlist[0][1]) + self.assertTrue("'tokens': ()" in response.headerlist[0][1]) def test_remember(self): helper = self._makeOne('secret') @@ -912,7 +912,9 @@ class TestAuthTktCookieHelper(unittest.TestCase): helper = self._makeOne('secret') request = self._makeRequest() la = text_(b'foo', 'utf-8') - helper.remember(request, 'other', tokens=(la,)) + result = helper.remember(request, 'other', tokens=(la,)) + # tokens must be str type on both Python 2 and 3 + self.assertTrue("'tokens': ('foo',)" in result[0][1]) def test_remember_nonascii_token(self): helper = self._makeOne('secret') |
