File: interfaces.py

package info (click to toggle)
zope.security 3.7.2-1
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 700 kB
  • ctags: 1,209
  • sloc: python: 3,744; ansic: 2,216; makefile: 3; sh: 1
file content (68 lines) | stat: -rw-r--r-- 2,204 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
##############################################################################
#
# 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.1 (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
#
##############################################################################
"""Proxy-related interfaces.

$Id: interfaces.py 69377 2006-08-08 16:33:57Z fdrake $
"""

from zope.interface import Interface

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

    def isProxy(obj, proxytype=None):
        """Check whether the given object is a proxy

        If proxytype is not None, checkes whether the object is
        proxied by the given proxytype.
        """

    def sameProxiedObjects(ob1, ob2):
        """Check whether ob1 and ob2 are the same or proxies of the same object
        """

    def getProxiedObject(obj):
        """Get the proxied Object

        If the object isn't proxied, then just return the object.
        """

    def setProxiedObject(ob1, ob2):
        """Set the underlying object for ob1 to ob2, returning the old object.

        Raises TypeError if ob1 is not a 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 queryProxy(obj, proxytype, default=None):
        """Look for a proxy of the given type around the object

        If no such proxy can be found, return the default.
        """

    def queryInnerProxy(obj, proxytype, default=None):
        """Look for the inner-most proxy of the given type around the object

        If no such proxy can be found, return the default.

        If there is such a proxy, return the inner-most one.
        """