[Checkins] SVN: z3c.pt/trunk/src/z3c/pt/README.txt - Add failing test for 'default' usage in path expressions for tal:content (works for tal:attributes)
Sidnei da Silva
sidnei at enfoldsystems.com
Mon Jan 19 17:38:50 EST 2009
Log message for revision 94865:
- Add failing test for 'default' usage in path expressions for tal:content (works for tal:attributes)
Changed:
U z3c.pt/trunk/src/z3c/pt/README.txt
-=-
Modified: z3c.pt/trunk/src/z3c/pt/README.txt
===================================================================
--- z3c.pt/trunk/src/z3c/pt/README.txt 2009-01-19 22:27:24 UTC (rev 94864)
+++ z3c.pt/trunk/src/z3c/pt/README.txt 2009-01-19 22:38:50 UTC (rev 94865)
@@ -184,3 +184,35 @@
<span>test</span>
<span>test</span>
</div>
+
+'default' and path expressions
+------------------------------
+
+Another feature from standard ZPT: using 'default' means whatever the
+the literal HTML contains will be output if the condition is not met.
+
+This works for attributes:
+
+ >>> template = PageTemplate("""\
+ ... <div xmlns="http://www.w3.org/1999/xhtml">
+ ... <span tal:attributes="class options/not-existing | default"
+ ... class="blue">i'm blue</span>
+ ... </div>""")
+
+ >>> print template()
+ <div xmlns="http://www.w3.org/1999/xhtml">
+ <span class="blue">i'm blue</span>
+ </div>
+
+And also for contents:
+
+ >>> template = PageTemplate("""\
+ ... <div xmlns="http://www.w3.org/1999/xhtml">
+ ... <span tal:content="options/not-existing | default"
+ ... >default content</span>
+ ... </div>""")
+
+ >>> print template()
+ <div xmlns="http://www.w3.org/1999/xhtml">
+ <span>default content</span>
+ </div>
More information about the Checkins
mailing list