[Zope3-checkins] CVS: Zope3/src/zope/app/component - hooks.py:1.5.8.10

Steve Alexander steve@cat-box.net
Fri, 16 May 2003 09:52:48 -0400


Update of /cvs-repository/Zope3/src/zope/app/component
In directory cvs.zope.org:/tmp/cvs-serv14925/src/zope/app/component

Modified Files:
      Tag: stevea-decorators-branch
	hooks.py 
Log Message:
Corrected recently added XXX comment.
Now, an object that is not Proxied, but does have a __Security_checker__
attribute will be decorated with a __Security_checker__ attribute that
resolves to a decorated checker.


=== Zope3/src/zope/app/component/hooks.py 1.5.8.9 => 1.5.8.10 ===
--- Zope3/src/zope/app/component/hooks.py:1.5.8.9	Fri May 16 09:37:26 2003
+++ Zope3/src/zope/app/component/hooks.py	Fri May 16 09:52:17 2003
@@ -98,19 +98,20 @@
     The wrapped object will declare that it provides the interfaces that the
     wrapped object provides plus the interfaces given in the DecoratorSpec.
     """
-    if type(ob) is Proxy:
+    obj_is_proxy = type(ob) is Proxy
+    if obj_is_proxy:
         checker = getChecker(ob)
         unproxied_ob = getObject(ob)
     else:
-        checker = None
+        checker = getattr(ob, '__Security_checker__', None)
         unproxied_ob = ob
+
     if spec.mixinIsTrusted:
         inner = None
     else:
         inner = ob
+
     attrdict = {}
-    # XXX also, if ob has an attr __Security_checker__, then we should make
-    # the __Security_checker__, but not return a proxy.
     if checker is not None:
         if spec.permissionMap or spec.setPermissionMap:
             checker = DecoratedChecker(checker, spec.permissionMap,
@@ -122,6 +123,6 @@
             spec.mixinInterfaceSpec + providedBy(unproxied_ob))
     d = Decorator(unproxied_ob, parent, spec.mixinFactory, spec.names,
                   attrdict, inner, **kw)
-    if checker is not None:
+    if obj_is_proxy:
         d = Proxy(d, checker)
     return d