Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

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
@malcolmt malcolmt authored
View
1  django/contrib/sessions/backends/cache.py
@@ -14,6 +14,7 @@ def load(self):
if session_data is not None:
return session_data
self.create()
+ return {}
def create(self):
while True:
View
4 django/contrib/sessions/tests.py
@@ -10,6 +10,7 @@
>>> db_session = DatabaseSession()
>>> db_session.modified
False
+>>> db_session.get('cat')
>>> db_session['cat'] = "dog"
>>> db_session.modified
True
@@ -42,6 +43,7 @@
>>> Session.objects.filter(pk=db_session.session_key).delete()
>>> db_session = DatabaseSession(db_session.session_key)
>>> db_session.save()
+>>> DatabaseSession('1').get('cat')
>>> file_session = FileSession()
>>> file_session.modified
@@ -59,6 +61,7 @@
>>> file_session.delete(file_session.session_key)
>>> file_session.exists(file_session.session_key)
False
+>>> FileSession('1').get('cat')
>>> file_session['foo'] = 'bar'
>>> file_session.save()
@@ -112,6 +115,7 @@
>>> Session.objects.filter(pk=cache_session.session_key).delete()
>>> cache_session = CacheSession(cache_session.session_key)
>>> cache_session.save()
+>>> CacheSession('1').get('cat')
>>> s = SessionBase()
>>> s._session['some key'] = 'exists' # Pre-populate the session with some data
Please sign in to comment.
Something went wrong with that request. Please try again.