[Checkins] SVN: z3c.pt/trunk/src/z3c/pt/template.txt Add failing test for define-slot / fill-slot behavior.

Chris McDonough chrism at plope.com
Tue Aug 19 01:49:33 EDT 2008


Log message for revision 89992:
  Add failing test for define-slot / fill-slot behavior.
  

Changed:
  U   z3c.pt/trunk/src/z3c/pt/template.txt

-=-
Modified: z3c.pt/trunk/src/z3c/pt/template.txt
===================================================================
--- z3c.pt/trunk/src/z3c/pt/template.txt	2008-08-19 05:25:29 UTC (rev 89991)
+++ z3c.pt/trunk/src/z3c/pt/template.txt	2008-08-19 05:49:32 UTC (rev 89992)
@@ -171,6 +171,35 @@
     </div>
     Hello, earth!
   </div>
+
+metal:define-macro, metal:use-macro, metal:define-slot, metal:fill-slot
+
+  >>> main = PageTemplate("""\
+  ... <html xmlns="http://www.w3.org/1999/xhtml"
+  ...       xmlns:tal="http://xml.zope.org/namespaces/tal"
+  ...       xmlns:metal="http://xml.zope.org/namespaces/metal"
+  ...       metal:define-macro="master">
+  ...   <div tal:define-slot="content">
+  ...       I will be replaced
+  ...   </div>
+  ... </html>""")
+
+  >>> content = PageTemplate("""\
+  ... <div xmlns="http://www.w3.org/1999/xhtml"
+  ...      xmlns:tal="http://xml.zope.org/namespaces/tal"
+  ...      xmlns:metal="http://xml.zope.org/namespaces/metal"
+  ...      metal:use-macro="main.macros['master']">
+  ...   <div metal:fill-slot="content">
+  ...       I replace you.
+  ...   </div>
+  ... </div>""")
+
+  >>> print content(main=main)
+  <html>
+    <div>
+         I replace you.
+    </div>
+  </html>
   
 Error handling
 --------------



More information about the Checkins mailing list