Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fixed #9548 -- Correctly detect existence of empty sessions with cach…

…e backend.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@9934 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit d77236960a5d3792bf9514fb7834d2813f531054 1 parent 70911bf
@malcolmt malcolmt authored
View
2  django/contrib/sessions/backends/cache.py
@@ -43,7 +43,7 @@ def save(self, must_create=False):
raise CreateError
def exists(self, session_key):
- if self._cache.get(session_key):
+ if self._cache.has_key(session_key):
return True
return False
View
5 django/contrib/sessions/tests.py
@@ -182,6 +182,11 @@
False
>>> cache_session.items() == prev_data
True
+>>> cache_session = CacheSession()
+>>> cache_session.save()
+>>> key = cache_session.session_key
+>>> cache_session.exists(key)
+True
>>> Session.objects.filter(pk=cache_session.session_key).delete()
>>> cache_session = CacheSession(cache_session.session_key)
Please sign in to comment.
Something went wrong with that request. Please try again.