Fixed #28167 -- Fixed cache backend's SessionStore.exists() if session_key is None.
This commit is contained in:
parent
584e10c76e
commit
578e576c31
|
@ -67,7 +67,7 @@ class SessionStore(SessionBase):
|
|||
raise CreateError
|
||||
|
||||
def exists(self, session_key):
|
||||
return session_key and (self.cache_key_prefix + session_key) in self._cache
|
||||
return bool(session_key) and (self.cache_key_prefix + session_key) in self._cache
|
||||
|
||||
def delete(self, session_key=None):
|
||||
if session_key is None:
|
||||
|
|
|
@ -348,7 +348,8 @@ class SessionTestsMixin:
|
|||
session = self.backend('someunknownkey')
|
||||
session.load()
|
||||
|
||||
self.assertFalse(session.exists(session.session_key))
|
||||
self.assertIsNone(session.session_key)
|
||||
self.assertIs(session.exists(session.session_key), False)
|
||||
# provided unknown key was cycled, not reused
|
||||
self.assertNotEqual(session.session_key, 'someunknownkey')
|
||||
|
||||
|
|
Loading…
Reference in New Issue