changeset 4195:2d8a9f98382b

Added 'destroy_session' to session service api
author Florian Krupicka <florian.krupicka@googlemail.com>
date Sat, 28 Jun 2008 15:36:50 +0200
parents 9c80451df643
children 42660b499488
files MoinMoin/web/api.py MoinMoin/web/session.py
diffstat 2 files changed, 9 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/web/api.py	Sat Jun 28 15:34:51 2008 +0200
+++ b/MoinMoin/web/api.py	Sat Jun 28 15:36:50 2008 +0200
@@ -30,9 +30,11 @@
     def get_session(request):
         """ Return a session object pertaining to the particular request."""
 
+    def destroy_session(request, session):
+        """ Destroy an existing session (make it unusable). """
+
     def finalize(request, session):
         """
         Do final modifications to the request and/or session before sending
         headers and body to the cliebt.
         """
-        
--- a/MoinMoin/web/session.py	Sat Jun 28 15:34:51 2008 +0200
+++ b/MoinMoin/web/session.py	Sat Jun 28 15:36:50 2008 +0200
@@ -44,6 +44,11 @@
             session = self.store.get(sid)
         return session
 
+    def destroy_session(self, request, session):
+        session.clear()
+        self.store.delete(session)
+        session.modified = session.new = False
+
     def finalize(self, request, session):
         userobj = request.user
         if userobj and userobj.valid:
@@ -55,7 +60,7 @@
             logging.debug("after auth: storing valid user into session: %r" % userobj.name)
         else:
             if 'user.id' in session:
-                request.cfg.session_service.delete(session)                
+                self.destroy_session(request, session)
 
         if session.should_save:
             self.store.save(session)