[Zope3-checkins] CVS: Zope3/lib/python/Zope/Security - Checker.py:1.11

Jim Fulton jim@zope.com
Tue, 19 Nov 2002 18:25:48 -0500


Update of /cvs-repository/Zope3/lib/python/Zope/Security
In directory cvs.zope.org:/tmp/cvs-serv11465/lib/python/Zope/Security

Modified Files:
	Checker.py 
Log Message:

Two changes that were far reaching and interdependent.

- Changed existing directives that mention interfaces to register
  those interfaces with the global interface service.

- Moved all configuration support (except that in Zope.Configuration)
  into Zope.App. This was necessary to get the order of execution such
  that the interface service was defined before directives that used
  interfaces were used.  This is a change that has been needed for
  some time.



=== Zope3/lib/python/Zope/Security/Checker.py 1.10 => 1.11 ===
--- Zope3/lib/python/Zope/Security/Checker.py:1.10	Thu Nov  7 09:33:05 2002
+++ Zope3/lib/python/Zope/Security/Checker.py	Tue Nov 19 18:25:17 2002
@@ -244,8 +244,24 @@
     The appropriate checker is returned or None is returned. If the
     return value is None, then object should not be wrapped in a proxy.
     """
-    checker = _getChecker(type(object), _defaultChecker)
+
+    # We need to be careful here. We might have a proxy, in which case
+    # we can't use the type.  OTOH, we might not be able to use the
+    # __class__ either, since not everything has one.
+
+    # XXX we really need formal proxy introspection
+
+    if type(object) is Proxy:
+        # Is this already a security proxy?
+        return None
+    
+    checker = _getChecker(getattr(object, '__class__', type(object)),
+                          _defaultChecker)
+    
     if checker is NoProxy:
+        return None
+
+    if checker is _defaultChecker and isinstance(object, Exception):
         return None
 
     while not isinstance(checker, Checker):