1
0
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:
Tim Graham 2017-05-03 10:09:28 -04:00
parent 584e10c76e
commit 578e576c31
2 changed files with 3 additions and 2 deletions

View File

@ -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:

View File

@ -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')