[Zope3-checkins] CVS: Zope3/src/zope/app/component - hooks.py:1.5.8.9
Steve Alexander
steve@cat-box.net
Fri, 16 May 2003 09:37:57 -0400
Update of /cvs-repository/Zope3/src/zope/app/component
In directory cvs.zope.org:/tmp/cvs-serv12684/src/zope/app/component
Modified Files:
Tag: stevea-decorators-branch
hooks.py
Log Message:
Improvements in documentation.
Added one XXX comment for a case I handn't thought of that needs to be
tested for and implemented.
=== Zope3/src/zope/app/component/hooks.py 1.5.8.8 => 1.5.8.9 ===
--- Zope3/src/zope/app/component/hooks.py:1.5.8.8 Thu May 15 10:49:26 2003
+++ Zope3/src/zope/app/component/hooks.py Fri May 16 09:37:26 2003
@@ -66,9 +66,8 @@
return serviceManager
def ContextWrapper_hook(_ob, _parent, **kw):
+ """Decoration-aware replacement for zope.proxy.context.ContextWrapper_hook
"""
- """
- # XXX This needs a test
t = type(_ob)
if t in BasicTypes:
# Don't wrap basic objects
@@ -90,6 +89,15 @@
return _ob
def decorate(spec, ob, parent, kw):
+ """Decorate an object according to the given DecoratorSpec.
+
+ If the object is security-proxied, the wrapper that is returned will be
+ security-proxied, using a checker with extra or overridden values from
+ the DecoratorSpec.
+
+ 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:
checker = getChecker(ob)
unproxied_ob = getObject(ob)
@@ -101,6 +109,8 @@
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,