[Zope3-checkins] CVS: Zope3/src/zope/proxy/interfaces - __init__.py:1.1.2.1 context.py:1.1.2.1

Jim Fulton jim@zope.com
Mon, 23 Dec 2002 14:33:08 -0500


Update of /cvs-repository/Zope3/src/zope/proxy/interfaces
In directory cvs.zope.org:/tmp/cvs-serv19908/zope/proxy/interfaces

Added Files:
      Tag: NameGeddon-branch
	__init__.py context.py 
Log Message:
Initial renaming before debugging

=== Added File Zope3/src/zope/proxy/interfaces/__init__.py ===
##############################################################################
#
# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
# All Rights Reserved.
# 
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL).  A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE
# 
##############################################################################
"""

Revision information:
$Id: __init__.py,v 1.1.2.1 2002/12/23 19:33:07 jim Exp $
"""

from zope.interface import Interface

class IProxyIntrospection(Interface):
    """Provides methods for indentifying proxies and extracting proxied objects
    """

    def removeProxy(obj):
        """Return the immediately proxied object.

        If obj is not a proxied object, return obj.

        Note that the object returned may still be a proxy, if there
        are multiple layers of proxy.
        """

    def removeAllProxies(obj):
        """Get the proxied object with no proxies

        If obj is not a proxied object, return obj.

        The returned object has no proxies.
        """

    def isProxy(obj):
        """Checks whether the given object is a proxy
        """




=== Added File Zope3/src/zope/proxy/interfaces/context.py ===
##############################################################################
#
# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
# All Rights Reserved.
# 
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL).  A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
# 
##############################################################################
import zope.interface

class IWrapperFuncs(Interface.Interface):
    """ Interface implemented by callables in 'wrapper' module """
    def Wrapper(object, context=None, **data):
        """
        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.

        Wrapper data may be passed as keyword arguments. The data are
        added to the context dictionary.
        """
        
    def getobject(obj):
        """
        Return the wrapped object. If obj is not a wrapper object, return obj.
        """
    def getbaseobject(obj):
        """
        Return the innermost wrapped object.  If obj is not a wrapper,
        return obj.
        """
    def getinnerwrapper(obj):
        """
        Return the innermost wrapper in a chain of wrappers with obj at the
        head. If obj is wrapped, 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, return None.
        """
    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.Interface):
    def __getstate__():
        """ Raises AttributeError if called (to prevent pickling) """


"""

Revision information:
$Id: context.py,v 1.1.2.1 2002/12/23 19:33:07 jim Exp $
"""
from zope.interface import Interface

class IContextWrapper(Interface):

    def ContextWrapper(object, parent, **data):
        """Create a context wrapper for object in parent

        If the object is in a security proxy, then result will will be
        a security proxy for the unproxied object in context.

        Consider an object, o1, in a proxy p1 with a checker c1.

        If we call ContextWrapper(p1, parent, name='foo'), then we'll
        get::

          Proxy(Wrapper(o1, parent, name='foo'), c1)
          
        """

    def getWrapperData(ob):
        """Get the context wrapper data for an object
        """

    def getInnerWrapperData(ob):
        """Get the inner (container) context wrapper data for an object
        """

    def getWrapperContainer(ob):
        """Get the object's container, as computed from a context wrapper
        """

    def getWrapperContext(ob):
        """Get the object's context, as computed from a context wrapper
        """
        
    def isWrapper(ob):
        """If the object is wrapped in a context wrapper, returns true,
        otherwise returns false.
        """

    def ContainmentIterator(ob):
        """Get an iterator for the object's containment chain
        """