[Checkins] SVN: five.grok/trunk/src/five/grok/ftests/view/resource.py Add test on exists: for resources.

Sylvain Viollon sylvain at infrae.com
Tue Apr 7 11:02:30 EDT 2009


Log message for revision 98977:
  Add test on exists: for resources.
  
  

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 14:58:29 UTC (rev 98976)
+++ five.grok/trunk/src/five/grok/ftests/view/resource.py	2009-04-07 15:02:29 UTC (rev 98977)
@@ -35,7 +35,17 @@
   <a href="http://localhost/manfred/++resource++five.grok.ftests.view/style.css">A link to some style for life!</a>
   </body>
   </html>
+  >>> browser.open("http://localhost/manfred/exists")
+  >>> print browser.contents
+  <html>
+  <body>
+  <span>Test succeed</span>
+  <BLANKLINE>
+  </body>
+  </html>
+  <BLANKLINE>
 
+
 """
 from five import grok
 
@@ -59,3 +69,20 @@
 </body>
 </html>
 """)
+
+
+class Exists(grok.View):
+    pass
+
+exists = grok.PageTemplate("""\
+<html>
+<body>
+<span
+   tal:condition="exists: view/static/style.css">Test succeed</span>
+<span
+   tal:condition="exists: view/static/nonexistant.css">Test failed</span>
+</body>
+</html>
+""")
+
+



More information about the Checkins mailing list