[Zope3-checkins] CVS: Zope3/lib/python/Zope/Proxy - ContextWrapper.py:1.8

Steve Alexander steve@cat-box.net
Mon, 16 Dec 2002 07:34:03 -0500


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

Modified Files:
	ContextWrapper.py 
Log Message:
Further to Jeremy's comment on the nonsensical code here:

http://lists.zope.org/pipermail/zope3-checkins/2002-December/002575.html

Yes, _contextWrapperChecker(ob) should be returning a checker.

defineChecker(_Wrapper, _contextWrapperChecker) won't work, becuase 
_Wrapper is a factory function, not a type. This is lameness in the 
Zope/ContextWrapper package -- Wrapper was originally both a type and
a factory. Now it is only a factory. You need to iterate through
wrapperTypes to get all of the available types of ContextWrapper.
The interactions of different kinds of proxies and wrappers in Zope 3
needs a fresh look and some refactoring. Let's hope we can get to this
before the alpha.

defineChecker should really check that it is given a type.




=== Zope3/lib/python/Zope/Proxy/ContextWrapper.py 1.7 => 1.8 ===
--- Zope3/lib/python/Zope/Proxy/ContextWrapper.py:1.7	Fri Dec 13 18:07:44 2002
+++ Zope3/lib/python/Zope/Proxy/ContextWrapper.py	Mon Dec 16 07:34:02 2002
@@ -70,10 +70,10 @@
     return _ob
 
 def _contextWrapperChecker(ob):
-    # XXX Should the checker be returned?
-    checker = selectChecker(getobject(ob))
+    return selectChecker(getobject(ob))
 
-defineChecker(_Wrapper, _contextWrapperChecker)
+for wrapper_type in wrapperTypes:
+    defineChecker(wrapper_type, _contextWrapperChecker)
 
 def getWrapperData(_ob):
     if type(_ob) is Proxy: