diff options
| -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() |
