Skip to content

Commit

Permalink
Fixed #9548 -- Correctly detect existence of empty sessions with cach…
Browse files Browse the repository at this point in the history
…e backend.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@9934 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information
malcolmt committed Mar 1, 2009
1 parent 70911bf commit d772369
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion django/contrib/sessions/backends/cache.py
Expand Up @@ -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

Expand Down
5 changes: 5 additions & 0 deletions django/contrib/sessions/tests.py
Expand Up @@ -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)
Expand Down

0 comments on commit d772369

Please sign in to comment.