[Zope-Checkins] CVS: Zope3/lib/python/Zope/PageTemplate - ViewZPT.py:1.1.2.4

Steve Alexander steve@cat-box.net
Sun, 24 Mar 2002 14:19:50 -0500


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

Modified Files:
      Tag: Zope-3x-branch
	ViewZPT.py 
Log Message:
Test written for ViewZPT.py.
After consulting with Jim, removed the change that allowed the instance
passed in not to have a getContext method.
It turned out to be really crufty to get rid of namespace['here'], as it
is set to instance in ZPT.pt_getContext, where ZPT is the base class of
ViewZPT.


=== Zope3/lib/python/Zope/PageTemplate/ViewZPT.py 1.1.2.3 => 1.1.2.4 ===
 
 class ViewZPT(ZPT):
-    def pt_getContext(self, instance, **keywords):
+    def pt_getContext(self, instance, request, **keywords):
         # instance is a View component
-        namespace = ZPT.pt_getContext(self, instance=instance, **keywords)
+        namespace = ZPT.pt_getContext(self, instance, request, **keywords)
 
-        here = getattr(instance, 'getContext', None)
-        if here is not None:        
-            namespace['here'] = here()
-            namespace['views'] = ViewMapper(namespace['here'],
-                                            namespace['request'])
+        namespace['here'] = instance.getContext()
+        namespace['views'] = ViewMapper(namespace['here'],
+                                        namespace['request'])
         return namespace