durusmail: quixote-users: session patch
session patch
2002-08-08
2002-08-08
session patch
Jonathan Corbet
2002-08-08
Here's a little thing I found in the process of converting my session code
over.  I *thought* I could drop my maintain_session for the Quixote
version, but that version now misses one case: the session is empty, but
we're remembering an older, non-empty version.  This is the logout case, at
least the way I did it...  This patch, I would hope, doesn't break
anything, and lets me drop my version of maintain_session.

diff -u session.py.orig session.py
--- session.py.orig     2002-08-08 13:04:56.000000000 -0600
+++ session.py  2002-08-08 15:41:06.000000000 -0600
@@ -319,6 +319,10 @@
         """
         if not session.has_info():
             # Session has no useful info -- forget it.
+            # jc: *really* forget it if it used to have info
+            if self.has_session(session.id):
+                del self[session.id]
+                self.revoke_session_cookie(request)
             return

         if not self.has_session(session.id):


jon

Jonathan Corbet
Executive editor, LWN.net
corbet@lwn.net


reply