zope.security.proxy

An introduction to proxies and their uses can be found in Untrusted Interpreters and Security Proxies.

zope.security.proxy.getChecker()

get checker from proxy

zope.security.proxy.removeSecurityProxy()

Get the proxied object

Return the original object if not proxied.

zope.security.proxy.getTestProxyItems(proxy)[source]

Return a sorted sequence of checker names and permissions for testing

zope.security.proxy.isinstance(object, cls)[source]

Test whether an object is an instance of a type.

This works even if the object is security proxied.

>>> from zope.security.proxy import isinstance
>>> class C1(object):
...     pass

>>> c = C1()
>>> isinstance(c, C1)
True

>>> from zope.security.checker import ProxyFactory
>>> isinstance(ProxyFactory(c), C1)
True

>>> class C2(C1):
...     pass

>>> c = C2()
>>> isinstance(c, C1)
True

>>> from zope.security.checker import ProxyFactory
>>> isinstance(ProxyFactory(c), C1)
True
zope.security.proxy.Proxy

alias of _Proxy

class zope.security.proxy.ProxyPy(value, checker)[source]

The pure-Python reference implementation of a security proxy.

This should normally not be created directly, instead use the ProxyFactory().

You can choose to use this implementation instead of the C implementation by default by setting the PURE_PYTHON environment variable before zope.security is imported.