[Zope-CVS] CVS: Packages/ContextWrapper - IWrapper.py:1.1
Chris McDonough
chrism@zope.com
Tue, 27 Nov 2001 17:37:58 -0500
Update of /cvs-repository/Packages/ContextWrapper
In directory cvs.zope.org:/tmp/cvs-serv21864
Added Files:
IWrapper.py
Log Message:
Interface file describes module interface.
=== Added File Packages/ContextWrapper/IWrapper.py ===
import Interface
class IWrapperFuncs(Interface.Base):
""" Interface implemented by callables in 'wrapper' module """
def Wrapper(object, context=None):
"""
Create and return a new context wrapper for object. If context is
given and not None, context will be the context object. Wrapper can
be subclassed.
"""
def getobject(obj):
"""
Return the wrapped object. If obj is not a wrapper object, return obj.
"""
def getinnerobject(obj):
"""
Return the innermost wrapped object in a chain of wrappers with obj
at the head. If obj is not a wrapper object, just return obj.
"""
def getinnercontext(obj):
"""
Return the context object from the innermost wrapper in a chain
with obj at the head. If the innermost wrapper has not context
object, return None. If obj is not a wrapper object, just return obj.
"""
def getcontext(obj):
"""
Return the context object if there is one, or None. If obj is not a
wrapper instance, return None.
"""
def getdict(obj):
"""
Return the context dictionary if there is one, or None. If obj is
not a wrapper instance, return None.
"""
def getdictcreate(wrapper):
"""
Return the context dictionary, creating it if it does not already
exist. Raises TypeError if wrapper is not a wrapper object.
"""
def setobject(wrapper, object):
"""
Replace the wrapped object with object. Raises TypeError if wrapper
is not a wrapper object.
"""
def setcontext(wrapper, context):
"""
Replace the context object with context. If context is None, it will
be represented as NULL in C API. Raises TypeError if wrapper is not
a wrapper object.
"""
class IWrapper(Interface.Base):
def __getstate__():
""" Raises AttributeError if called (to prevent pickling """