Commit d7723696 authored by Malcolm Tredinnick's avatar Malcolm Tredinnick
Browse files

Fixed #9548 -- Correctly detect existence of empty sessions with cache backend.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@9934 bcc190cf-cafb-0310-a4f2-bffc1f526a37
parent 70911bf9
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -43,7 +43,7 @@ class SessionStore(SessionBase):
            raise CreateError

    def exists(self, session_key):
        if self._cache.get(session_key):
        if self._cache.has_key(session_key):
            return True
        return False

+5 −0
Original line number Diff line number Diff line
@@ -182,6 +182,11 @@ False
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)