summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBrian Sutherland <brian@vanguardistas.net>2016-05-05 12:45:34 +0200
committerBrian Sutherland <brian@vanguardistas.net>2016-05-05 12:47:10 +0200
commit3439c00479fa56d588378656bc038dfb54177bf9 (patch)
tree01e067ac81fa4ec6e6d35ba26b67cd0a7ef8792d /src
parent4d564f6a331bc46c434d792b9525d8785e1b4a3f (diff)
downloadzope-proxy-3439c00479fa56d588378656bc038dfb54177bf9.tar.gz
Fix removing pure python security proxies
The test is simple but requires zope.security to be installed. I chose that over writing the test in zope.security
Diffstat (limited to 'src')
-rw-r--r--src/zope/proxy/__init__.py2
-rw-r--r--src/zope/proxy/tests/test_proxy.py11
2 files changed, 12 insertions, 1 deletions
diff --git a/src/zope/proxy/__init__.py b/src/zope/proxy/__init__.py
index fd3e531..2efb7b8 100644
--- a/src/zope/proxy/__init__.py
+++ b/src/zope/proxy/__init__.py
@@ -507,7 +507,7 @@ def py_queryInnerProxy(obj, klass=None, default=None):
def py_removeAllProxies(obj):
while isinstance(obj, PyProxyBase):
- obj = obj._wrapped
+ obj = super(PyProxyBase, obj).__getattribute__('_wrapped')
return obj
_c_available = False
diff --git a/src/zope/proxy/tests/test_proxy.py b/src/zope/proxy/tests/test_proxy.py
index c4a7574..176ce2b 100644
--- a/src/zope/proxy/tests/test_proxy.py
+++ b/src/zope/proxy/tests/test_proxy.py
@@ -1276,6 +1276,11 @@ class Test_py_removeAllProxies(unittest.TestCase):
from zope.proxy import PyProxyBase
return PyProxyBase(obj)
+ def _makeSecurityProxy(self, obj):
+ from zope.security.proxy import ProxyPy
+ checker = object()
+ return ProxyPy(obj, checker)
+
def test_no_proxy(self):
class C(object):
pass
@@ -1297,6 +1302,12 @@ class Test_py_removeAllProxies(unittest.TestCase):
proxy2 = self._makeProxy(proxy)
self.assertTrue(self._callFUT(proxy2) is c)
+ def test_security_proxy(self):
+ class C(object):
+ pass
+ c = C()
+ proxy = self._makeSecurityProxy(c)
+ self.assertTrue(self._callFUT(proxy) is c)
class Test_removeAllProxies(unittest.TestCase):