[Zope3-checkins] CVS: Zope3/lib/python/Zope/Security/tests - testChecker.py:1.5.6.1
Jim Fulton
jim@zope.com
Thu, 14 Nov 2002 13:27:12 -0500
Update of /cvs-repository/Zope3/lib/python/Zope/Security/tests
In directory cvs.zope.org:/tmp/cvs-serv15337/tests
Modified Files:
Tag: Zope3-Bangalore-TTW-Branch
testChecker.py
Log Message:
Fixed bug: Proxy creation wasn't done correctly for context-wrapped objects
=== Zope3/lib/python/Zope/Security/tests/testChecker.py 1.5 => 1.5.6.1 ===
--- Zope3/lib/python/Zope/Security/tests/testChecker.py:1.5 Tue Oct 1 08:47:50 2002
+++ Zope3/lib/python/Zope/Security/tests/testChecker.py Thu Nov 14 13:27:12 2002
@@ -43,6 +43,14 @@
############################################################
+class TransparentProxy(object):
+ def __init__(self, ob):
+ self._ob = ob
+
+ def __getattribute__(self, name):
+ ob = object.__getattribute__(self, '_ob')
+ return getattr(ob, name)
+
class OldInst:
a=1
@@ -187,15 +195,16 @@
special = NamesChecker(['a', 'b'], 'test_allowed')
defineChecker(class_, special)
- proxy = checker.proxy(inst)
- self.failUnless(getObject(proxy) is inst)
+ for ob in inst, TransparentProxy(inst):
+ proxy = checker.proxy(ob)
+ self.failUnless(getObject(proxy) is ob)
-
- checker = getChecker(proxy)
- self.failUnless(checker is special, checker.__dict__)
+ checker = getChecker(proxy)
+ self.failUnless(checker is special,
+ checker.getPermission_func().__self__)
- proxy2 = checker.proxy(proxy)
- self.failUnless(proxy2 is proxy, [proxy, proxy2])
+ proxy2 = checker.proxy(proxy)
+ self.failUnless(proxy2 is proxy, [proxy, proxy2])
def testMultiChecker(self):
from Interface import Interface