[Checkins] SVN: five.grok/trunk/src/five/grok/ftests/view/resource.py Add test exists using traverse.
Sylvain Viollon
sylvain at infrae.com
Tue Apr 7 11:11:13 EDT 2009
Log message for revision 98978:
Add test exists using traverse.
Changed:
U five.grok/trunk/src/five/grok/ftests/view/resource.py
-=-
Modified: five.grok/trunk/src/five/grok/ftests/view/resource.py
===================================================================
--- five.grok/trunk/src/five/grok/ftests/view/resource.py 2009-04-07 15:02:29 UTC (rev 98977)
+++ five.grok/trunk/src/five/grok/ftests/view/resource.py 2009-04-07 15:11:12 UTC (rev 98978)
@@ -35,6 +35,9 @@
<a href="http://localhost/manfred/++resource++five.grok.ftests.view/style.css">A link to some style for life!</a>
</body>
</html>
+
+ We can use exists on resource files:
+
>>> browser.open("http://localhost/manfred/exists")
>>> print browser.contents
<html>
@@ -44,6 +47,15 @@
</body>
</html>
<BLANKLINE>
+ >>> browser.open("http://localhost/manfred/existsandtraverse")
+ >>> print browser.contents
+ <html>
+ <body>
+ <span>Test succeed</span>
+ <BLANKLINE>
+ </body>
+ </html>
+ <BLANKLINE>
"""
@@ -86,3 +98,18 @@
""")
+class ExistsAndTraverse(grok.View):
+ pass
+
+existsandtraverse = grok.PageTemplate("""\
+<html>
+<body>
+<span
+ tal:condition="exists: context/++resource++five.grok.ftests.view/style.css">Test succeed</span>
+<span
+ tal:condition="exists: context/++resource++five.grok.ftests.view/nonexistant.css">Test failed</span>
+</body>
+</html>
+""")
+
+
More information about the Checkins
mailing list