Delete the session cookie on an empty session.
authorBrett Smith <brettcsmith@brettcsmith.org>
Sun, 24 Mar 2013 18:47:02 +0000 (14:47 -0400)
committerBrett Smith <brettcsmith@brettcsmith.org>
Sun, 24 Mar 2013 18:47:02 +0000 (14:47 -0400)
mediagoblin/tools/session.py

index 676bc43e2785966317a06c03619e4772c95fd296..303907b9e337f826cb0898557ae7280293df56cb 100644 (file)
@@ -57,4 +57,7 @@ class SessionManager(object):
     def save_session_to_cookie(self, session, response):
         if not session.is_updated:
             return
-        response.set_cookie(self.cookie_name, self.signer.dumps(session))
+        elif not session:
+            response.delete_cookie(self.cookie_name)
+        else:
+            response.set_cookie(self.cookie_name, self.signer.dumps(session))