[Zope3-checkins]
SVN: Zope3/branches/jim-call-checkers/src/zope/security/checker.py
Changed strategy for NoProxy to make C implementation simpler.
Jim Fulton
jim at zope.com
Fri Oct 7 18:15:41 EDT 2005
Log message for revision 38911:
Changed strategy for NoProxy to make C implementation simpler.
Changed:
U Zope3/branches/jim-call-checkers/src/zope/security/checker.py
-=-
Modified: Zope3/branches/jim-call-checkers/src/zope/security/checker.py
===================================================================
--- Zope3/branches/jim-call-checkers/src/zope/security/checker.py 2005-10-07 22:10:56 UTC (rev 38910)
+++ Zope3/branches/jim-call-checkers/src/zope/security/checker.py 2005-10-07 22:15:41 UTC (rev 38911)
@@ -212,7 +212,14 @@
def check(self, object, name):
'See IChecker'
- permission = self.get_permissions.get(name)
+ try:
+ permission = self.get_permissions.get(name)
+ except AttributeError:
+ if self.get_permissions is None:
+ # special case for NoProxy
+ return
+ raise
+
if permission is not None:
if permission is CheckerPublic:
return # Public
@@ -239,6 +246,9 @@
return checker(value)
def __call__(self, value):
+ if self.get_permissions is None:
+ # special case for NoProxy
+ return value
return Proxy(value, self)
@@ -421,17 +431,9 @@
'type_ must be a type, class or module, not a %s' % type_)
del _checkers[type_]
+NoProxy = Checker({})
+NoProxy.get_permissions = None
-class NoProxyChecker(Checker):
-
- def check(self, object, name):
- pass
-
- def __call__(self, object):
- return object
-
-NoProxy = NoProxyChecker({})
-
# _checkers is a mapping.
#
# - Keys are types
More information about the Zope3-Checkins
mailing list