[Zope3-checkins] CVS: Zope3/src/zope/proxy/interfaces - context.py:1.9
Steve Alexander
steve@cat-box.net
Mon, 12 May 2003 10:59:38 -0400
Update of /cvs-repository/Zope3/src/zope/proxy/interfaces
In directory cvs.zope.org:/tmp/cvs-serv14584/src/zope/proxy/interfaces
Modified Files:
context.py
Log Message:
New "inner" member of Decorators, in preparation of support for untrusted
decorators.
Improved getattr and setattr code so that name can't be GCed during the
function call, and we're more strict about checking that name is a
string. (Or a unicode that can be coerced into a string.)
Used PyType_HasFeature to check if we're allowed to look at a descriptor's
class's tp_descr_{get,set} slots.
=== Zope3/src/zope/proxy/interfaces/context.py 1.8 => 1.9 ===
--- Zope3/src/zope/proxy/interfaces/context.py:1.8 Fri May 9 10:02:56 2003
+++ Zope3/src/zope/proxy/interfaces/context.py Mon May 12 10:59:37 2003
@@ -134,7 +134,7 @@
"""Interface implemented by callables in 'decorator' module"""
def Decorator(object, context=None, mixinfactory=None, names=(),
- attrdict={}, **data):
+ attrdict={}, inner=None, **data):
"""Create and return a new decorator for object.
Decorator is a subtype of Wrapper.
@@ -159,12 +159,16 @@
If the same name appears in names and in attrdict, the behaviour is
as if the name appeared only in attrdict.
+ 'inner' is the decorated object that is to be passed to the
+ mixinfactory callable. If 'inner' is None, then object is passed
+ instead.
+
Wrapper data may be passed as keyword arguments. The data are added
to the context dictionary.
- Note that the arguments object, context, mixinfactory, names, and
- attrdict must be given as positional arguments. All keyword arguments
- are taken to be part of **data.
+ Note that the arguments object, context, mixinfactory, names,
+ attrdict, and inner must be given as positional arguments. All
+ keyword arguments are taken to be part of **data.
"""
def getmixin(obj):
@@ -186,6 +190,14 @@
dict is created properly. It should otherwise be considered
a private API.
"""
+
+ def getinner(obj):
+ """Returns the 'inner' that is passed to a mixin factory callable.
+
+ If no 'inner' object was given when the decorator was created,
+ this function is equivalent to IWrapperFuncs.getobject(obj).
+ """
+
class IDecorator(IWrapper):
"""A Decorator is a subtype of Wrapper.