[CMF-checkins] CVS: CMF - CookieCrumbler.py:1.7

shane@digicool.com shane@digicool.com
Fri, 25 May 2001 14:05:00 -0400 (EDT)


Update of /cvs-repository/CMF/CMFCore
In directory korak.digicool.com:/tmp/cvs-serv22191

Modified Files:
	CookieCrumbler.py 
Log Message:
Simplified the login disabling logic.



--- Updated File CookieCrumbler.py in package CMF --
--- CookieCrumbler.py	2001/05/21 20:49:12	1.6
+++ CookieCrumbler.py	2001/05/25 18:05:00	1.7
@@ -98,6 +98,7 @@
 from ZPublisher.HTTPRequest import HTTPRequest
 
 # Constants.
+ATTEMPT_DISABLED = -1
 ATTEMPT_NONE = 0
 ATTEMPT_LOGIN = 1
 ATTEMPT_CONT = 2
@@ -168,12 +169,10 @@
         # Returns flags indicating what the user is trying to do.
 
         if req.__class__ is not HTTPRequest:
-            req[ 'disable_cookie_login__' ] = 1
-            return ATTEMPT_NONE
+            return ATTEMPT_DISABLED
 
         if not req[ 'REQUEST_METHOD' ] in ( 'GET', 'PUT', 'POST' ):
-            req[ 'disable_cookie_login__' ] = 1
-            return ATTEMPT_NONE
+            return ATTEMPT_DISABLED
 
         if not req._auth:
             if (req.has_key(self.pw_cookie) and
@@ -211,6 +210,8 @@
         '''The __before_publishing_traverse__ hook.'''
         resp = self.REQUEST['RESPONSE']
         attempt = self.modifyRequest(req, resp)
+        if attempt == ATTEMPT_DISABLED:
+            return
         if self.auto_login_page:
             if not req.get('disable_cookie_login__', 0):
                 if (attempt == ATTEMPT_LOGIN or