[Zope-Checkins] CVS: Zope3/lib/python/Zope/App/PageTemplate/tests - testSimpleViewClass.py:1.3

Jim Fulton jim@zope.com
Tue, 18 Jun 2002 10:17:20 -0400


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

Modified Files:
	testSimpleViewClass.py 
Log Message:
Added the ability to specify templates in view pages rather than in
Python view classes.

Added the ability to supply a class when defiening views from
templates. In this case, the class becomes a base class of the
generated view class.

Added the ability to supply base classes to simple view classes.

Changed the zope page-template engine to use
Zope.App.Traversers.Traverser.Traverser directly, wo looking it up as
an adapter. I suspect that we'll stop making this pluggable, as it's
too much bother, given that adapters are used for each step anyway.



=== Zope3/lib/python/Zope/App/PageTemplate/tests/testSimpleViewClass.py 1.2 => 1.3 ===
                          '    <p>hello world</p>\n'
                          '  </body>\n</html>\n')
-                         
+
+    def testWBases(self):
+        from Zope.App.PageTemplate.SimpleViewClass import SimpleViewClass
+
+        class C: pass
+        
+        SimpleTestView = SimpleViewClass('testSimpleViewClass.pt', bases=(C, ))
+        
+        self.failUnless(issubclass(SimpleTestView, C))
+
+        ob = data()
+        view = SimpleTestView(ob, None)        
+        macro = view['test']
+        out = view()
+        self.assertEqual(out,
+                         '<html>\n'
+                         '  <body>\n'
+                         '    <p>hello world</p>\n'
+                         '  </body>\n</html>\n')
 
 def test_suite():
     loader=unittest.TestLoader()