[Zope3-checkins] CVS: Zope3/src/zope/security/tests - test_checker.py:1.13
Steve Alexander
steve@cat-box.net
Mon, 2 Jun 2003 13:43:05 -0400
Update of /cvs-repository/Zope3/src/zope/security/tests
In directory cvs.zope.org:/tmp/cvs-serv10642/src/zope/security/tests
Modified Files:
test_checker.py
Log Message:
Implemented descriptor for __Security_checker__ of context wrappers.
This descriptor gets a checker for the wrapper and for the proxied object,
and returns a checker combined from both of those.
If either the wrapper or the proxied object has no checker defined, then
the checker for the proxied object or the wrapper is returned,
respectively.
If no checkers are defined, None is returned.
=== Zope3/src/zope/security/tests/test_checker.py 1.12 => 1.13 ===
--- Zope3/src/zope/security/tests/test_checker.py:1.12 Mon Jun 2 10:36:04 2003
+++ Zope3/src/zope/security/tests/test_checker.py Mon Jun 2 13:43:04 2003
@@ -212,7 +212,6 @@
rocks += (AttributeError(), AttributeError)
for rock in rocks:
proxy = checker.proxy(rock)
-
self.failUnless(proxy is rock, (rock, type(proxy)))
for class_ in OldInst, NewInst:
@@ -229,19 +228,22 @@
self.assertEqual(checker.permission_id('__str__'),
CheckerPublic)
- special = NamesChecker(['a', 'b'], 'test_allowed')
- defineChecker(class_, special)
-
- for ob in inst, TransparentProxy(inst):
- proxy = checker.proxy(ob)
- self.failUnless(getProxiedObject(proxy) is ob)
-
- checker = getChecker(proxy)
- self.failUnless(checker is special,
- checker.getPermission_func().__self__)
-
- proxy2 = checker.proxy(proxy)
- self.failUnless(proxy2 is proxy, [proxy, proxy2])
+ #No longer doing anything special for transparent proxies.
+ #A proxy needs to provide its own security checker.
+ #
+ #special = NamesChecker(['a', 'b'], 'test_allowed')
+ #defineChecker(class_, special)
+ #
+ #for ob in inst, TransparentProxy(inst):
+ # proxy = checker.proxy(ob)
+ # self.failUnless(getProxiedObject(proxy) is ob)
+ #
+ # checker = getChecker(proxy)
+ # self.failUnless(checker is special,
+ # checker.getPermission_func().__self__)
+ #
+ # proxy2 = checker.proxy(proxy)
+ # self.failUnless(proxy2 is proxy, [proxy, proxy2])
def testMultiChecker(self):
from zope.interface import Interface