Author: mtredinnick
Date: 2009-03-01 01:32:41 -0600 (Sun, 01 Mar 2009)
New Revision: 9934

Modified:
   django/trunk/django/contrib/sessions/backends/cache.py
   django/trunk/django/contrib/sessions/tests.py
Log:
Fixed #9548 -- Correctly detect existence of empty sessions with cache backend.

Modified: django/trunk/django/contrib/sessions/backends/cache.py
===================================================================
--- django/trunk/django/contrib/sessions/backends/cache.py      2009-03-01 
07:20:19 UTC (rev 9933)
+++ django/trunk/django/contrib/sessions/backends/cache.py      2009-03-01 
07:32:41 UTC (rev 9934)
@@ -43,7 +43,7 @@
             raise CreateError
 
     def exists(self, session_key):
-        if self._cache.get(session_key):
+        if self._cache.has_key(session_key):
             return True
         return False
 

Modified: django/trunk/django/contrib/sessions/tests.py
===================================================================
--- django/trunk/django/contrib/sessions/tests.py       2009-03-01 07:20:19 UTC 
(rev 9933)
+++ django/trunk/django/contrib/sessions/tests.py       2009-03-01 07:32:41 UTC 
(rev 9934)
@@ -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)


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to