[ZDP] BackTalk to Document The Zope Book (2.5 Edition)/Advanced Page Templates

webmaster@zope.org webmaster@zope.org
Sat, 12 Oct 2002 00:36:25 -0400


A comment to the paragraph below was recently added via http://www.zope.org/Documentation/Books/ZopeBook/current/AdvZPT.stx#3-46

---------------

      This template doesn't work because the condition is tested
      before the repeat is executed. The upshot is that the 'n'
      variable is not defined until after it is tested. Here's a way
      around this problem::

        % Anonymous User - Oct. 4, 2002 1:59 am:
         Post your example here: <;-)

        % Anonymous User - Oct. 12, 2002 12:36 am:
         <ul>
           <div tal:repeat="n python:range(10)"
                tal:omit-tag="">
           <li tal:condition="python:n != 3"
               tal:content="n">
             1
           </li>
           </div>
         </ul>