mirror of
https://github.com/django/django.git
synced 2024-12-22 17:16:24 +00:00
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
|
raise CreateError
|
||||||
|
|
||||||
def exists(self, session_key):
|
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):
|
def delete(self, session_key=None):
|
||||||
if session_key is None:
|
if session_key is None:
|
||||||
|
@ -348,7 +348,8 @@ class SessionTestsMixin:
|
|||||||
session = self.backend('someunknownkey')
|
session = self.backend('someunknownkey')
|
||||||
session.load()
|
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
|
# provided unknown key was cycled, not reused
|
||||||
self.assertNotEqual(session.session_key, 'someunknownkey')
|
self.assertNotEqual(session.session_key, 'someunknownkey')
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user