[z3-checkins] r5150 - in z3/Five/trunk: . tests tests/products/FiveTest

faassen at codespeak.net faassen at codespeak.net
Thu Jun 17 19:09:03 MEST 2004


Author: faassen
Date: Thu Jun 17 19:09:00 2004
New Revision: 5150

Modified:
   z3/Five/trunk/browser.py
   z3/Five/trunk/fiveconfigure.py
   z3/Five/trunk/tests/products/FiveTest/configure.zcml
   z3/Five/trunk/tests/products/FiveTest/falcon.pt
   z3/Five/trunk/tests/test_five.py
Log:
Added a test for no-class template, and fixed code accordingly. This template
also demonstrates the simple use of TALES.

Also twiddled a bit with line endings so that tests are more consistent. 


Modified: z3/Five/trunk/browser.py
==============================================================================
--- z3/Five/trunk/browser.py	(original)
+++ z3/Five/trunk/browser.py	Thu Jun 17 19:09:00 2004
@@ -13,6 +13,7 @@
     # as this makes Zope 2 traverse into that first!
     
     def __call__(self, *args, **kw):
+        # XXX this is definitely not the way Zope 3 does it..
         if hasattr(self, 'index'):
             return self.index(self, *args, **kw)
         attr = self.__page_attribute__

Modified: z3/Five/trunk/fiveconfigure.py
==============================================================================
--- z3/Five/trunk/fiveconfigure.py	(original)
+++ z3/Five/trunk/fiveconfigure.py	Thu Jun 17 19:09:00 2004
@@ -65,7 +65,7 @@
 
     else:
         # template
-        new_class = SimpleViewClass(template)
+        new_class = SimpleViewClass(template, bases=(BrowserView,))
 
     _handle_for(_context, for_)
 

Modified: z3/Five/trunk/tests/products/FiveTest/configure.zcml
==============================================================================
--- z3/Five/trunk/tests/products/FiveTest/configure.zcml	(original)
+++ z3/Five/trunk/tests/products/FiveTest/configure.zcml	Thu Jun 17 19:09:00 2004
@@ -20,4 +20,10 @@
     name="falcon.html"
     />
 
+  <five:page
+    for=".interfaces.ISimpleContent"
+    template="owl.pt"
+    name="owl.html"
+    />
+
 </configure>

Modified: z3/Five/trunk/tests/products/FiveTest/falcon.pt
==============================================================================
--- z3/Five/trunk/tests/products/FiveTest/falcon.pt	(original)
+++ z3/Five/trunk/tests/products/FiveTest/falcon.pt	Thu Jun 17 19:09:00 2004
@@ -1,2 +1 @@
-<p>The falcon has taken flight</p>
-
+<p>The falcon has taken flight</p>
\ No newline at end of file

Modified: z3/Five/trunk/tests/test_five.py
==============================================================================
--- z3/Five/trunk/tests/test_five.py	(original)
+++ z3/Five/trunk/tests/test_five.py	Thu Jun 17 19:09:00 2004
@@ -50,7 +50,14 @@
         view = self.root.unrestrictedTraverse('testoid/falcon.html')
         self.assert_(isinstance(view, SimpleContentView))
         data = view()
-        self.assertEquals(u'<p>The falcon has taken flight</p>\n\n', data)
+        self.assertEquals(u'<p>The falcon has taken flight</p>\n', data)
+
+    def test_template_view_without_class(self):
+        self.root.manage_addProduct['FiveTest'].manage_addSimpleContent(
+            'testoid', 'Testoid')
+        view = self.root.unrestrictedTraverse('testoid/owl.html')
+        data = view()
+        self.assertEquals(u'<p>2</p>\n', data)
         
     def test_view_backwards_compatibility(self):
         self.root.manage_addProduct['FiveTest'].manage_addSimpleContent(


More information about the z3-checkins mailing list