[Checkins] SVN: five.grok/trunk/src/five/grok/ftests/view/ Add tests for grok.PageTemplateFile.
Sylvain Viollon
sylvain at infrae.com
Sat Nov 15 09:30:44 EST 2008
Log message for revision 92973:
Add tests for grok.PageTemplateFile.
Changed:
A five.grok/trunk/src/five/grok/ftests/view/file.py
A five.grok/trunk/src/five/grok/ftests/view/zope2_template.pt
-=-
Added: five.grok/trunk/src/five/grok/ftests/view/file.py
===================================================================
--- five.grok/trunk/src/five/grok/ftests/view/file.py (rev 0)
+++ five.grok/trunk/src/five/grok/ftests/view/file.py 2008-11-15 14:30:44 UTC (rev 92973)
@@ -0,0 +1,28 @@
+"""
+ >>> from five.grok.ftests.view.file import *
+ >>> id = getRootFolder()._setObject("manfred", Mammoth(id='manfred'))
+
+ >>> from Products.Five.testbrowser import Browser
+ >>> browser = Browser()
+ >>> browser.handleErrors = False
+ >>> browser.open("http://localhost/manfred/@@painting")
+ >>> print browser.contents
+ <html>
+ <body>
+ <h1>Hello, world manfred!</h1>
+ </body>
+ </html>
+
+"""
+from five import grok
+
+class Mammoth(grok.Model):
+
+ def __init__(self, id):
+ super(Mammoth, self).__init__(id=id)
+ self.id = id
+
+class Painting(grok.View):
+ pass
+
+painting = grok.PageTemplateFile("zope2_template.pt")
Added: five.grok/trunk/src/five/grok/ftests/view/zope2_template.pt
===================================================================
--- five.grok/trunk/src/five/grok/ftests/view/zope2_template.pt (rev 0)
+++ five.grok/trunk/src/five/grok/ftests/view/zope2_template.pt 2008-11-15 14:30:44 UTC (rev 92973)
@@ -0,0 +1,5 @@
+<html>
+<body>
+<h1>Hello, world <tal:replace tal:replace="here/id" />!</h1>
+</body>
+</html>
More information about the Checkins
mailing list