[Checkins] SVN: z3c.pt/trunk/ Added condition to the valid attributes on tags in the tal namespace.

Hanno Schlichting plone at hannosch.info
Sat Jun 14 05:21:16 EDT 2008


Log message for revision 87386:
  Added condition to the valid attributes on tags in the tal namespace.
  

Changed:
  U   z3c.pt/trunk/docs/HISTORY.txt
  U   z3c.pt/trunk/src/z3c/pt/translation.py
  U   z3c.pt/trunk/src/z3c/pt/translation.txt

-=-
Modified: z3c.pt/trunk/docs/HISTORY.txt
===================================================================
--- z3c.pt/trunk/docs/HISTORY.txt	2008-06-14 07:44:05 UTC (rev 87385)
+++ z3c.pt/trunk/docs/HISTORY.txt	2008-06-14 09:21:15 UTC (rev 87386)
@@ -4,6 +4,8 @@
 Version 0.8.x
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
+- Added condition to the valid attributes on tags in the tal namespace.
+
 - Made sure the traceback from the *first* template exception
   is carried over to __traceback_info__
 

Modified: z3c.pt/trunk/src/z3c/pt/translation.py
===================================================================
--- z3c.pt/trunk/src/z3c/pt/translation.py	2008-06-14 07:44:05 UTC (rev 87385)
+++ z3c.pt/trunk/src/z3c/pt/translation.py	2008-06-14 09:21:15 UTC (rev 87386)
@@ -337,6 +337,7 @@
     
 class TALElement(Element):
     define = attribute("define", lambda p: p.definitions)
+    condition = attribute("condition", lambda p: p.expression)
     replace = attribute("replace", lambda p: p.output)
     repeat = attribute("repeat", lambda p: p.definition)
     attributes = attribute("attributes", lambda p: p.expression)
@@ -350,6 +351,7 @@
         for key in self.keys():
             if key not in \
                    ('define',
+                    'condition',
                     'replace',
                     'repeat',
                     'attributes',

Modified: z3c.pt/trunk/src/z3c/pt/translation.txt
===================================================================
--- z3c.pt/trunk/src/z3c/pt/translation.txt	2008-06-14 07:44:05 UTC (rev 87385)
+++ z3c.pt/trunk/src/z3c/pt/translation.txt	2008-06-14 09:21:15 UTC (rev 87386)
@@ -69,6 +69,24 @@
       </ul>
     </div>
 
+Conditions:
+
+  >>> print render("""\
+  ... <div xmlns="http://www.w3.org/1999/xhtml"
+  ...      xmlns:tal="http://xml.zope.org/namespaces/tal">
+  ...   <div tal:condition="True">
+  ...     Show me!
+  ...   </div>
+  ...   <div tal:condition="False">
+  ...     Do not show me!
+  ...   </div>
+  ... </div>""", translate_xml)
+    <div>
+      <div>
+        Show me!
+      </div>
+    </div>
+
 Comments:
 
   >>> print render("""\
@@ -94,6 +112,7 @@
   ...   <tal:example replace="'Hello World!'" />
   ...   <tal:div content="'Hello World!'" />
   ...   <tal:multiple repeat="i range(3)" replace="i" />
+  ...   <tal:div condition="True">True</tal:div>
   ... </div>""", translate_xml)
     <div>
       Hello World!
@@ -101,6 +120,7 @@
       0
       1
       2
+      True
     </div>
 
 Omitting tags:



More information about the Checkins mailing list