[Zope3-checkins] CVS: Zope3/src/zope/context - interfaces.py:1.15
Jim Fulton
jim@zope.com
Thu, 12 Jun 2003 05:29:01 -0400
Update of /cvs-repository/Zope3/src/zope/context
In directory cvs.zope.org:/tmp/cvs-serv26057/src/zope/context
Modified Files:
interfaces.py
Log Message:
Added an interface definition for the context descriptor utilities.
Ultimately, this was to support making the available in zapi.
=== Zope3/src/zope/context/interfaces.py 1.14 => 1.15 ===
--- Zope3/src/zope/context/interfaces.py:1.14 Sat Jun 7 09:00:01 2003
+++ Zope3/src/zope/context/interfaces.py Thu Jun 12 05:29:00 2003
@@ -150,3 +150,44 @@
innermost wrapper.
"""
+ def ContextIterator(ob):
+ """Get an iterator for the object's context chain.
+
+ The iteration starts at ob and proceeds through ob's contexts.
+ """
+
+class IContextAwareDescriptorSupport(Interface):
+ """Special utilities for creating context-aware descriptors
+
+ A context-aware descriptors is bound to context wrappers, rather than to
+ unwrapped instances.
+ """
+
+ ContextDescriptor = Attribute(
+ """Marker descriptor base class
+
+ Descriptor implementations that subclass this class will have
+ wrappers passed to their descriptor methods if they are
+ accessed through wrapped objects.
+ """)
+
+ def ContextMethod(method):
+ """Convert ordinary methods to context-aware methods.
+
+ The first argument passed to methods will be context wrapped
+ if the method is called on a context-wrapped instance.
+
+ """
+
+ def ContextProperty(fget, fset=None, fdel=None):
+ """\
+ Create a property with functions to be passed context-wrapped instances
+
+ This function works like Python's property function, except
+ that the access functions are passed context-warpped instances.
+ """
+
+ def ContextSuper(cls, wrapped_instance):
+ """Call an inherited method on a wrapped instances
+ """
+