Skip to content
This repository has been archived by the owner on Feb 13, 2020. It is now read-only.

Commit

Permalink
Add a 'set' method to the ZopeCookieSession
Browse files Browse the repository at this point in the history
This is expected by external APIs including PluggableAuthService
  • Loading branch information
Sheila Allen committed Apr 28, 2016
1 parent 96bb506 commit ea5ae08
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
3 changes: 3 additions & 0 deletions zope2/sessioncookie/__init__.py
Expand Up @@ -47,6 +47,9 @@ def __guarded_setitem__(self, key, value):
def __guarded_delitem__(self, key):
del self[key]

def set(self, key, value):
self[key] = value

InitializeClass(ZopeCookieSession)

return ZopeCookieSession
Expand Down
8 changes: 8 additions & 0 deletions zope2/sessioncookie/tests/test___init__.py
Expand Up @@ -63,6 +63,14 @@ def test_session_class_extras(self):
request._response_callbacks[0](request, response)
self.assertEqual(response.counter, 1)

def test_session_class_set_method(self):
self._setUpUtility()
klass = self._callFUT()
request = _Request()
session = klass(request)
session.set('foo', 'bar')
self.assertEqual(session.__guarded_getitem__('foo'), 'bar')


class SignedSessionCookieCreatedTests(unittest.TestCase):

Expand Down

0 comments on commit ea5ae08

Please sign in to comment.