[Zope3-checkins] CVS: Zope3/src/zope/security - checker.py:1.22.2.3 proxy.py:1.4.24.1
Steve Alexander
steve@cat-box.net
Thu, 15 May 2003 10:50:07 -0400
Update of /cvs-repository/Zope3/src/zope/security
In directory cvs.zope.org:/tmp/cvs-serv12712/src/zope/security
Modified Files:
Tag: stevea-decorators-branch
checker.py proxy.py
Log Message:
More work on Decorators.
Converted existing tests to use decorators instead of ZopeContainerAdapter.
=== Zope3/src/zope/security/checker.py 1.22.2.2 => 1.22.2.3 ===
--- Zope3/src/zope/security/checker.py:1.22.2.2 Wed May 14 09:54:12 2003
+++ Zope3/src/zope/security/checker.py Thu May 15 10:49:36 2003
@@ -71,7 +71,10 @@
directlyProvides(ProxyFactory, ISecurityProxyFactory)
-class Checker:
+class TrustedCheckerBase:
+ pass
+
+class Checker(TrustedCheckerBase):
__implements__ = IChecker
@@ -228,7 +231,7 @@
raise
-class DecoratedChecker:
+class DecoratedChecker(TrustedCheckerBase):
"""A checker using further permissions relative to an original checker.
"""
@@ -319,6 +322,17 @@
self._original_checker.check_setattr(object, name)
return
+ def proxy(self, value):
+ 'See IChecker'
+ # Now we need to create a proxy
+
+ checker = getattr(value, '__Security_checker__', None)
+ if checker is None:
+ checker = selectChecker(value)
+ if checker is None:
+ return value
+
+ return Proxy(value, checker)
if WATCH_CHECKERS:
class Checker(CheckerLoggingMixin, Checker):
=== Zope3/src/zope/security/proxy.py 1.4 => 1.4.24.1 ===
--- Zope3/src/zope/security/proxy.py:1.4 Thu Dec 26 13:42:47 2002
+++ Zope3/src/zope/security/proxy.py Thu May 15 10:49:36 2003
@@ -18,12 +18,13 @@
from zope.security._proxy import getObject, getChecker
from zope.security._proxy import _Proxy as Proxy
-from zope.security.checker import Checker as _trustedChecker
+from zope.security.checker import TrustedCheckerBase as _trustedChecker
# This import represents part of the API for this module
from zope.security.checker import ProxyFactory
def trustedRemoveSecurityProxy(object):
+ # XXX This function needs a docstring and some tests!
if ((type(object) is Proxy) and
isinstance(getChecker(object), _trustedChecker)
):