mirror of
https://github.com/django/django.git
synced 2024-12-23 01:25:58 +00:00
Refs #21608 -- Fixed incorrect cache key in cache session backend's save().
The bug was introduced commit 3389c5ea22
.
This commit is contained in:
parent
fdf5cd3429
commit
5faf745999
@ -57,7 +57,7 @@ class SessionStore(SessionBase):
|
|||||||
return self.create()
|
return self.create()
|
||||||
if must_create:
|
if must_create:
|
||||||
func = self._cache.add
|
func = self._cache.add
|
||||||
elif self._cache.get(self.session_key) is not None:
|
elif self._cache.get(self.cache_key) is not None:
|
||||||
func = self._cache.set
|
func = self._cache.set
|
||||||
else:
|
else:
|
||||||
raise UpdateError
|
raise UpdateError
|
||||||
|
@ -613,6 +613,12 @@ class CacheSessionTests(SessionTestsMixin, unittest.TestCase):
|
|||||||
self.assertEqual(caches['default'].get(self.session.cache_key), None)
|
self.assertEqual(caches['default'].get(self.session.cache_key), None)
|
||||||
self.assertNotEqual(caches['sessions'].get(self.session.cache_key), None)
|
self.assertNotEqual(caches['sessions'].get(self.session.cache_key), None)
|
||||||
|
|
||||||
|
def test_create_and_save(self):
|
||||||
|
self.session = self.backend()
|
||||||
|
self.session.create()
|
||||||
|
self.session.save()
|
||||||
|
self.assertIsNotNone(caches['default'].get(self.session.cache_key))
|
||||||
|
|
||||||
|
|
||||||
class SessionMiddlewareTests(TestCase):
|
class SessionMiddlewareTests(TestCase):
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user