diff options
author | Stephan Richter <stephan.richter@gmail.com> | 2013-03-10 21:30:26 -0400 |
---|---|---|
committer | Stephan Richter <stephan.richter@gmail.com> | 2013-03-10 21:30:26 -0400 |
commit | 4d01d7ff8cf8d4c657758d04b75aba7c0fdae97a (patch) | |
tree | 40d5b35dbbae6f4af7d37379478ff7d5c6a1f3ea /src/zope/security/proxy.py | |
parent | 19f01d59f4b4e7dac9a714d202c5f44e7a850701 (diff) | |
download | zope-security-4d01d7ff8cf8d4c657758d04b75aba7c0fdae97a.tar.gz |
Fixed all attr access: __getattr__, __setattr__, __delattr__.
The main work consisted of making sure that access is allowed and that
results are also proxied.
Diffstat (limited to 'src/zope/security/proxy.py')
-rw-r--r-- | src/zope/security/proxy.py | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/zope/security/proxy.py b/src/zope/security/proxy.py index 48892bf..0fc4f7c 100644 --- a/src/zope/security/proxy.py +++ b/src/zope/security/proxy.py @@ -81,19 +81,28 @@ class ProxyPy(PyProxyBase): return checker if name not in ['__cmp__', '__hash__', '__bool__']: checker.check_getattr(wrapped, name) - return super(ProxyPy, self).__getattribute__(name) + return checker.proxy(super(ProxyPy, self).__getattribute__(name)) def __getattr__(self, name): - return getattr(self._wrapped, name) + wrapped = super(PyProxyBase, self).__getattribute__('_wrapped') + checker = super(PyProxyBase, self).__getattribute__('_checker') + checker.check_getattr(wrapped, name) + return checker.proxy(getattr(self._wrapped, name)) def __setattr__(self, name, value): if name in ('_wrapped', '_checker'): return super(PyProxyBase, self).__setattr__(name, value) + wrapped = super(PyProxyBase, self).__getattribute__('_wrapped') + checker = super(PyProxyBase, self).__getattribute__('_checker') + checker.check_setattr(wrapped, name) setattr(self._wrapped, name, value) def __delattr__(self, name): if name in ('_wrapped', '_checker'): raise AttributeError() + wrapped = super(PyProxyBase, self).__getattribute__('_wrapped') + checker = super(PyProxyBase, self).__getattribute__('_checker') + checker.check_setattr(wrapped, name) delattr(self._wrapped, name) def __cmp__(self, other): |