diff options
author | Brian Sutherland <brian@vanguardistas.net> | 2016-05-05 12:45:34 +0200 |
---|---|---|
committer | Brian Sutherland <brian@vanguardistas.net> | 2016-05-05 12:47:10 +0200 |
commit | 3439c00479fa56d588378656bc038dfb54177bf9 (patch) | |
tree | 01e067ac81fa4ec6e6d35ba26b67cd0a7ef8792d | |
parent | 4d564f6a331bc46c434d792b9525d8785e1b4a3f (diff) | |
download | zope-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
-rw-r--r-- | CHANGES.rst | 2 | ||||
-rw-r--r-- | setup.py | 2 | ||||
-rw-r--r-- | src/zope/proxy/__init__.py | 2 | ||||
-rw-r--r-- | src/zope/proxy/tests/test_proxy.py | 11 |
4 files changed, 15 insertions, 2 deletions
diff --git a/CHANGES.rst b/CHANGES.rst index 5308515..5e25ba0 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -11,6 +11,8 @@ Changes - Add support for Python 3.5. +- Fixed failure when using removeAllProxies with zope.security proxies. + 4.1.6 (2015-06-02) ------------------ @@ -87,7 +87,7 @@ setup(name='zope.proxy', include_package_data = True, zip_safe = False, extras_require = { - 'testing': ['nose', 'coverage'], + 'testing': ['nose', 'coverage', 'zope.security'], 'docs': ['Sphinx', 'repoze.sphinx.autointerface'], }, ) 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): |