Document Actions
03/03/2005
tal:condition
This is mainly reminder for myself.
Couple of times i was beaten by something like following code:

<h2
    tal:define="my_var1 here/title_or_id|nothing; my_var2 python: []"
    tal:condition="my_var2|my_var1">
  Here goes text that won't be displayed because above condition is False,
  though one can assume that '|' is equivalent to python's 'or' and my_var1
  should be used(let's imagine my_var1 is true in this context) and it really would
  be the case if my_var2 was path expression, and that path didn't exist or was
  set to 'nothing'.
</h2>

To make it work, above could be changed to:
<h2
    tal:define="my_var1 here/title_or_id|nothing; my_var2 python: []"
    tal:condition="python:my_var2 or my_var1">
         TRUE
</h2>
 
  or using at first place before '|' path expression.
Posted by Ruslan Spivak @ 03/03/2005 02:00 PM. - Categories: coding, zope -  0 comments
Last modified: 01/31/2005 06:39 PM

Nuxeo Bloggers: Log in!
Nuxeo - Indesko - Nuxeo 5 Project
All content is copyrighted by their author.
CPSSkins is Copyright © 2003-2006 by Jean-Marc Orliaguet. | CPS is Copyright © 2002-2006 by Nuxeo SAS.