Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

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
Malcolm Tredinnick authored March 01, 2009
2  django/contrib/sessions/backends/cache.py
@@ -43,7 +43,7 @@ def save(self, must_create=False):
43 43
             raise CreateError
44 44
 
45 45
     def exists(self, session_key):
46  
-        if self._cache.get(session_key):
  46
+        if self._cache.has_key(session_key):
47 47
             return True
48 48
         return False
49 49
 
5  django/contrib/sessions/tests.py
@@ -182,6 +182,11 @@
182 182
 False
183 183
 >>> cache_session.items() == prev_data
184 184
 True
  185
+>>> cache_session = CacheSession()
  186
+>>> cache_session.save()
  187
+>>> key = cache_session.session_key
  188
+>>> cache_session.exists(key)
  189
+True
185 190
 
186 191
 >>> Session.objects.filter(pk=cache_session.session_key).delete()
187 192
 >>> cache_session = CacheSession(cache_session.session_key)

0 notes on commit d772369

Please sign in to comment.
Something went wrong with that request. Please try again.