diff options
| -rw-r--r-- | src/pyramid/security.py | 6 | ||||
| -rw-r--r-- | tests/test_security.py | 6 |
2 files changed, 11 insertions, 1 deletions
diff --git a/src/pyramid/security.py b/src/pyramid/security.py index f07bc0bfe..e3a978c52 100644 --- a/src/pyramid/security.py +++ b/src/pyramid/security.py @@ -439,8 +439,12 @@ class LegacySecurityPolicy: return authn.remember(request, userid, **kw) def forget(self, request, **kw): + if kw: + raise ValueError( + 'Legacy authentication policies do not support keyword ' + 'arguments for `forget`' + ) authn = self._get_authn_policy(request) - # XXX log warning if varkwargs were passed? return authn.forget(request) def permits(self, request, context, permission): diff --git a/tests/test_security.py b/tests/test_security.py index 715d99804..1c969e305 100644 --- a/tests/test_security.py +++ b/tests/test_security.py @@ -466,6 +466,12 @@ class TestLegacySecurityPolicy(unittest.TestCase): policy.forget(request), [('X-Pyramid-Test', 'logout')] ) + def test_forget_with_kwargs(self): + from pyramid.security import LegacySecurityPolicy + + policy = LegacySecurityPolicy() + self.assertRaises(ValueError, lambda: policy.forget(None, foo='bar')) + def test_permits(self): from pyramid.security import LegacySecurityPolicy |
