Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Fixed #8351 -- Fixed the returned value when we attempt to load a cac…

…he-backed session object that doesn't alreayd exist.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@8410 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 54f9a987137d649899cfc65c87eb8baf8308dc09 1 parent 6bcb493
Malcolm Tredinnick authored August 16, 2008
1  django/contrib/sessions/backends/cache.py
@@ -14,6 +14,7 @@ def load(self):
14 14
         if session_data is not None:
15 15
             return session_data
16 16
         self.create()
  17
+        return {}
17 18
 
18 19
     def create(self):
19 20
         while True:
4  django/contrib/sessions/tests.py
@@ -10,6 +10,7 @@
10 10
 >>> db_session = DatabaseSession()
11 11
 >>> db_session.modified
12 12
 False
  13
+>>> db_session.get('cat')
13 14
 >>> db_session['cat'] = "dog"
14 15
 >>> db_session.modified
15 16
 True
@@ -42,6 +43,7 @@
42 43
 >>> Session.objects.filter(pk=db_session.session_key).delete()
43 44
 >>> db_session = DatabaseSession(db_session.session_key)
44 45
 >>> db_session.save()
  46
+>>> DatabaseSession('1').get('cat')
45 47
 
46 48
 >>> file_session = FileSession()
47 49
 >>> file_session.modified
@@ -59,6 +61,7 @@
59 61
 >>> file_session.delete(file_session.session_key)
60 62
 >>> file_session.exists(file_session.session_key)
61 63
 False
  64
+>>> FileSession('1').get('cat')
62 65
 
63 66
 >>> file_session['foo'] = 'bar'
64 67
 >>> file_session.save()
@@ -112,6 +115,7 @@
112 115
 >>> Session.objects.filter(pk=cache_session.session_key).delete()
113 116
 >>> cache_session = CacheSession(cache_session.session_key)
114 117
 >>> cache_session.save()
  118
+>>> CacheSession('1').get('cat')
115 119
 
116 120
 >>> s = SessionBase()
117 121
 >>> s._session['some key'] = 'exists' # Pre-populate the session with some data

0 notes on commit 54f9a98

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