diff options
| author | RamiC <olokki@gmail.com> | 2015-10-31 09:56:28 +0200 |
|---|---|---|
| committer | RamiC <olokki@gmail.com> | 2015-10-31 09:56:28 +0200 |
| commit | fa7886f89b99b52bcbed6b7d3577e7f1caace3df (patch) | |
| tree | 77373fa6a0e550e7eba41dd3dfbb965922223303 | |
| parent | b6f0be8bba239fbc1a3104c530ec996d8a5ee62e (diff) | |
| download | pyramid-fa7886f89b99b52bcbed6b7d3577e7f1caace3df.tar.gz pyramid-fa7886f89b99b52bcbed6b7d3577e7f1caace3df.tar.bz2 pyramid-fa7886f89b99b52bcbed6b7d3577e7f1caace3df.zip | |
Convert max_age argument to int when applicable
| -rw-r--r-- | pyramid/session.py | 2 | ||||
| -rw-r--r-- | pyramid/tests/test_session.py | 8 |
2 files changed, 9 insertions, 1 deletions
diff --git a/pyramid/session.py b/pyramid/session.py index 18aa41a0f..fa85fe69c 100644 --- a/pyramid/session.py +++ b/pyramid/session.py @@ -238,7 +238,7 @@ def BaseCookieSessionFactory( # configuration parameters _cookie_name = cookie_name - _cookie_max_age = max_age + _cookie_max_age = max_age if max_age is None else int(max_age) _cookie_path = path _cookie_domain = domain _cookie_secure = secure diff --git a/pyramid/tests/test_session.py b/pyramid/tests/test_session.py index 68741b265..82e4fb001 100644 --- a/pyramid/tests/test_session.py +++ b/pyramid/tests/test_session.py @@ -322,6 +322,10 @@ class TestBaseCookieSession(SharedCookieSessionTests, unittest.TestCase): request = testing.DummyRequest() self.assertRaises(ValueError, self._makeOne, request, reissue_time='invalid value') + def test_cookie_max_age_invalid(self): + request = testing.DummyRequest() + self.assertRaises(ValueError, self._makeOne, request, max_age='invalid value') + class TestSignedCookieSession(SharedCookieSessionTests, unittest.TestCase): def _makeOne(self, request, **kw): from pyramid.session import SignedCookieSessionFactory @@ -369,6 +373,10 @@ class TestSignedCookieSession(SharedCookieSessionTests, unittest.TestCase): request = testing.DummyRequest() self.assertRaises(ValueError, self._makeOne, request, reissue_time='invalid value') + def test_cookie_max_age_invalid(self): + request = testing.DummyRequest() + self.assertRaises(ValueError, self._makeOne, request, max_age='invalid value') + def test_custom_salt(self): import time request = testing.DummyRequest() |
