[Zope-Checkins] CVS: Zope3/lib/python/Zope/ComponentArchitecture - ViewService.py:1.1.2.11

Jim Fulton jim@zope.com
Tue, 12 Feb 2002 20:04:55 -0500


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

Modified Files:
      Tag: Zope-3x-branch
	ViewService.py 
Log Message:
Changed the logic for checking for presense of setViewRequest to use
self as a marker, which is faster than using None. Also don't rely on
method having a truth value.


=== Zope3/lib/python/Zope/ComponentArchitecture/ViewService.py 1.1.2.10 => 1.1.2.11 ===
         view =  self.getView(object, name, type, default, skin)
 
-        setViewRequest = getattr(view, 'setViewRequest', None)
-        
-        if setViewRequest:
+        # using self as marker
+        setViewRequest = getattr(view, 'setViewRequest', self)        
+        if setViewRequest is not self:
             setViewRequest(request)
 
         return view