diff options
author | Tres Seaver <tseaver@palladion.com> | 2016-05-05 10:02:59 -0400 |
---|---|---|
committer | Tres Seaver <tseaver@palladion.com> | 2016-05-05 10:02:59 -0400 |
commit | afc35ebce9ed4c394a66d2e7faed9c78a4e07e9e (patch) | |
tree | 80a07e4c10a3e49a232f397b9d7240f7affbb7be | |
parent | 4d564f6a331bc46c434d792b9525d8785e1b4a3f (diff) | |
parent | 4f3b4fdf7f3cd2bfb892d0c9219c463919d94c8e (diff) | |
download | zope-proxy-afc35ebce9ed4c394a66d2e7faed9c78a4e07e9e.tar.gz |
Merge pull request #13 from zopefoundation/fix-removeAllProxies-for-securityproxies
Fix removing pure python security proxies
-rw-r--r-- | .travis.yml | 1 | ||||
-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 |
5 files changed, 16 insertions, 2 deletions
diff --git a/.travis.yml b/.travis.yml index 0df748c..469febd 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,6 +8,7 @@ python: - pypy install: - pip install . + - pip install zope.security script: - python setup.py test -q notifications: 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): |