[Zope-Checkins] CVS: Zope3/lib/python/Zope/Proxy - ContextWrapper.py:1.1.4.2 ProxyIntrospection.py:1.1.4.2

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


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

Modified Files:
      Tag: Zope-3x-branch
	ContextWrapper.py ProxyIntrospection.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/Proxy/ContextWrapper.py 1.1.4.1 => 1.1.4.2 ===
 
 from Zope.Security.Proxy import Proxy, getChecker, getObject
-from Zope.ContextWrapper import Wrapper as _Wrapper, getobject, getdict
+from Zope.ContextWrapper import Wrapper as _Wrapper
+from Zope.ContextWrapper import wrapperTypes, getobject, getdict
 from Zope.ContextWrapper import getcontext, getinnercontext
 from Zope.Security.Checker import defineChecker, selectChecker, BasicTypes
 
@@ -83,7 +84,7 @@
         if type(_ob) is Proxy:
             _ob = getObject(_ob)
         
-        if not isinstance(_ob, _Wrapper):
+        if type(_ob) not in wrapperTypes:
             raise StopIteration
 
         _ob = getinnercontext(_ob)


=== Zope3/lib/python/Zope/Proxy/ProxyIntrospection.py 1.1.4.1 => 1.1.4.2 ===
 
         # register context wrappers
-        from Zope.ContextWrapper import Wrapper, getobject
-        self._proxy_types[Wrapper] = getobject
+        from Zope.ContextWrapper import Wrapper, wrapperTypes, getobject
+        for wrapper_type in wrapperTypes:
+            self._proxy_types[wrapper_type] = getobject
         
     _clear = __init__