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.

Important announcement: Join the Nuxeo team and contribute to the Nuxeo project! We have open positions in France and the UK for open source Java EE developers and sales engineers, both junior and senior.

Like this post? Share it:


Trackback Pings

Trackback URL for this entry:
http://blogs.nuxeo.com/sections/blogs/ruslan_spivak/2005_03_03_tal_condition/tbping
Posted by Ruslan Spivak @ 03/03/2005 02:00 PM. - Categories: coding, zope -  0 comments

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.