[Zope-CVS] CVS: Products/PluggableAuthService - PluggableAuthService.py:1.18.2.2

Tres Seaver tseaver at zope.com
Fri Oct 8 11:16:23 EDT 2004


Update of /cvs-repository/Products/PluggableAuthService
In directory cvs.zope.org:/tmp/cvs-serv1430

Modified Files:
      Tag: pre-1_0_3-zbir-challenge-branch
	PluggableAuthService.py 
Log Message:


  - Implement daisy chain via a stack of "previous" _unauthorized objects.


=== Products/PluggableAuthService/PluggableAuthService.py 1.18.2.1 => 1.18.2.2 ===
--- Products/PluggableAuthService/PluggableAuthService.py:1.18.2.1	Fri Oct  8 10:22:49 2004
+++ Products/PluggableAuthService/PluggableAuthService.py	Fri Oct  8 11:15:52 2004
@@ -1097,6 +1097,9 @@
         """
         resp = req['RESPONSE']
         req._hold(ResponseCleanup(resp))
+        stack = getattr(resp, '_unauthorized_stack', [])
+        stack.append(resp._unauthorized)
+        resp._unauthorized_stack = stack
         resp._unauthorized = self._unauthorized
 
     #
@@ -1135,10 +1138,16 @@
         resp = self.REQUEST['RESPONSE']
         # No errors of any sort may propagate, and we don't care *what*
         # they are, even to log them.
-        try: del resp.unauthorized
-        except: pass
-        try: del resp._unauthorized
-        except: pass
+        stack = getattr(resp, '_unauthorized_stack', [])
+
+        if stack:
+            resp._unauthorized = stack.pop()
+        else:
+            try:
+                del resp._unauthorized
+            except:
+                pass
+
         return resp
 
     security.declarePublic( 'hasUsers' )
@@ -1274,10 +1283,22 @@
         #
         # No errors of any sort may propagate, and we don't care *what*
         # they are, even to log them.
-        try: del self.resp.unauthorized
-        except: pass
-        try: del self.resp._unauthorized
-        except: pass
-        try: del self.resp
-        except: pass
+        stack = getattr(self.resp, '_unauthorized_stack', [])
+        old = None
+
+        while stack:
+            old = stack.pop()
+
+        if old is not None:
+            self.resp._unauthorized = old
+        else:
+            try:
+                del self.resp._unauthorized
+            except:
+                pass
+
+        try:
+            del self.resp
+        except:
+            pass
 



More information about the Zope-CVS mailing list