Fixed a subtle corner case whereby sending a bad session ID generates new (unused) session entries in the database table.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@7001 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Malcolm Tredinnick 2008-01-06 12:53:09 +00:00
parent 70fe1ef262
commit 041e24dbde
2 changed files with 20 additions and 16 deletions

View File

@ -26,6 +26,8 @@ class SessionStore(SessionBase):
# Save immediately to minimize collision # Save immediately to minimize collision
self.save() self.save()
# Ensure the user is notified via a new cookie.
self.modified = True
return {} return {}
def exists(self, session_key): def exists(self, session_key):

View File

@ -46,6 +46,8 @@ class SessionStore(SessionBase):
self._session_key = self._get_new_session_key() self._session_key = self._get_new_session_key()
self._session_cache = {} self._session_cache = {}
self.save() self.save()
# Ensure the user is notified via a new cookie.
self.modified = True
finally: finally:
session_file.close() session_file.close()
except(IOError): except(IOError):