[Zope-Checkins] CVS: Zope3/lib/python/Zope/App/ZopePublication/tests - testZopePublication.py:1.1.2.27

Steve Alexander steve@cat-box.net
Tue, 28 May 2002 16:28:44 -0400


Update of /cvs-repository/Zope3/lib/python/Zope/App/ZopePublication/tests
In directory cvs.zope.org:/tmp/cvs-serv8407/lib/python/Zope/App/ZopePublication/tests

Modified Files:
      Tag: Zope-3x-branch
	testZopePublication.py 
Log Message:
Made ContextWrappers handle the __call__ slot for ContextMethods.

Removed comparisons of objects with Wrapper using isinstance, as this
will fail to work with Python 2.3, when isinstance will respect __class__.

Added wrapperTypes field to the Zope.ContextWrapper module. Now, the
factory for creating ContextWrappers and the types of context wrappers
you might find are handled by different members of Zope.ContextWrapper
module.

This is needed for comparing using type(ob) in wrapperTypes, rather than
isinstance.



=== Zope3/lib/python/Zope/App/ZopePublication/tests/testZopePublication.py 1.1.2.26 => 1.1.2.27 ===
 from Zope.Proxy.ContextWrapper import getWrapperContext
 from Zope.ContextWrapper import Wrapper
+from Zope.ContextWrapper import wrapperTypes
 import ZODB
 from ZODB.MappingStorage import MappingStorage
 from Zope.Publisher.Exceptions import Retry
@@ -215,7 +216,7 @@
         ob = DummyPublished()
         ob2 = pub.traverseName(self._createRequest('/bruce',pub), ob, 'bruce')
         self.failUnless(ob2 is not ob)
-        self.failUnless(isinstance(ob2, Wrapper))
+        self.failUnless(type(ob2) in wrapperTypes)
 
     def testAdaptedTraverseNameWrapping(self):
 
@@ -237,7 +238,7 @@
         ob['bruce2'] =  SimpleObject('bruce2')
         pub = self.klass(self.db)
         ob2 = pub.traverseName(self._createRequest('/bruce',pub), ob, 'bruce')
-        self.failUnless(isinstance(ob2, Wrapper))
+        self.failUnless(type(ob2) in wrapperTypes)
         unw = removeAllProxies(ob2)
         self.assertEqual(unw.v, 'bruce')
 
@@ -261,7 +262,7 @@
         pub = self.klass(self.db)
         ob2, x = pub.getDefaultTraversal(self._createRequest('/bruce',pub), ob)
         self.assertEqual(x, 'dummy')
-        self.failUnless(isinstance(ob2, Wrapper))
+        self.failUnless(type(ob2) in wrapperTypes)
         unw = removeAllProxies(ob2)
         self.assertEqual(unw.v, 'bruce')