Fixed #8351 -- Fixed the returned value when we attempt to load a cache-backed session object that doesn't alreayd exist.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@8410 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Malcolm Tredinnick 2008-08-16 15:54:36 +00:00
parent 6bcb4935f2
commit 54f9a98713
2 changed files with 5 additions and 0 deletions

View File

@ -14,6 +14,7 @@ class SessionStore(SessionBase):
if session_data is not None:
return session_data
self.create()
return {}
def create(self):
while True:

View File

@ -10,6 +10,7 @@ r"""
>>> db_session = DatabaseSession()
>>> db_session.modified
False
>>> db_session.get('cat')
>>> db_session['cat'] = "dog"
>>> db_session.modified
True
@ -42,6 +43,7 @@ False
>>> 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 @@ True
>>> 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 @@ False
>>> 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