summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTres Seaver <tseaver@palladion.com>2016-05-05 10:02:59 -0400
committerTres Seaver <tseaver@palladion.com>2016-05-05 10:02:59 -0400
commitafc35ebce9ed4c394a66d2e7faed9c78a4e07e9e (patch)
tree80a07e4c10a3e49a232f397b9d7240f7affbb7be
parent4d564f6a331bc46c434d792b9525d8785e1b4a3f (diff)
parent4f3b4fdf7f3cd2bfb892d0c9219c463919d94c8e (diff)
downloadzope-proxy-afc35ebce9ed4c394a66d2e7faed9c78a4e07e9e.tar.gz
Merge pull request #13 from zopefoundation/fix-removeAllProxies-for-securityproxies
Fix removing pure python security proxies
-rw-r--r--.travis.yml1
-rw-r--r--CHANGES.rst2
-rw-r--r--setup.py2
-rw-r--r--src/zope/proxy/__init__.py2
-rw-r--r--src/zope/proxy/tests/test_proxy.py11
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)
------------------
diff --git a/setup.py b/setup.py
index d8860e5..63cf239 100644
--- a/setup.py
+++ b/setup.py
@@ -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):