diff bitsyauth/__init__.py @ 9:73b2b5bccd52

* allow logout to pass through instead of failing * add a basic filter factory for single-user bitsyauth wrapper which reads bitsyblog users directory as format (this needs to be factored apart later)
author egj@socialplanning.org
date Mon, 04 Jan 2010 03:14:01 +0000
parents c958eb9300da
children 431bd76aabb7
line wrap: on
line diff
--- a/bitsyauth/__init__.py	Mon Jan 04 01:46:25 2010 +0000
+++ b/bitsyauth/__init__.py	Mon Jan 04 03:14:01 2010 +0000
@@ -350,14 +350,19 @@
         #        self.cookie_handler = cookie.middleware(auth, cookie_name=self.cookie, timeout=90) # minutes
 
         # paste.auth.auth_tkt
-        self.cookie_handler = auth_tkt.make_auth_tkt_middleware(auth, global_conf, secret, cookie_name=self.cookie, logout_path='/logout')
+        self.cookie_handler = auth_tkt.make_auth_tkt_middleware(
+            auth, global_conf, secret,
+            cookie_name=self.cookie, logout_path='/logout')
 
     def __call__(self, environ, start_response):
         if environ['PATH_INFO'] == '/logout':
-            pass        
-        return self.cookie_handler(environ, start_response)
+            pass
+        try:
+            return self.cookie_handler(environ, start_response)
+        except:
+            return self.logout(environ, start_response)
 
-    def logout(self, environ):
+    def logout(self, environ, start_response):
         req = Request(environ)
         keys = [ 'REMOTE_USER' ]
         #        keys = [ 'REMOTE_USER', 'AUTH_TYPE', 'paste.auth.cookie', 'paste.cookies', 'HTTP_COOKIE' ]  # XXX zealous kill