Author: mtredinnick
Date: 2009-03-01 01:33:45 -0600 (Sun, 01 Mar 2009)
New Revision: 9935

Modified:
   django/branches/releases/1.0.X/django/contrib/sessions/backends/cache.py
   django/branches/releases/1.0.X/django/contrib/sessions/tests.py
Log:
[1.0.X] Fixed #9548 -- Correctly detect existence of empty sessions with cache 
backend.

Backport of r9934 from trunk.

Modified: 
django/branches/releases/1.0.X/django/contrib/sessions/backends/cache.py
===================================================================
--- django/branches/releases/1.0.X/django/contrib/sessions/backends/cache.py    
2009-03-01 07:32:41 UTC (rev 9934)
+++ django/branches/releases/1.0.X/django/contrib/sessions/backends/cache.py    
2009-03-01 07:33:45 UTC (rev 9935)
@@ -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/branches/releases/1.0.X/django/contrib/sessions/tests.py
===================================================================
--- django/branches/releases/1.0.X/django/contrib/sessions/tests.py     
2009-03-01 07:32:41 UTC (rev 9934)
+++ django/branches/releases/1.0.X/django/contrib/sessions/tests.py     
2009-03-01 07:33:45 UTC (rev 9935)
@@ -156,6 +156,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