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.

(Post originally written by Ruslan Spivak on the old Nuxeo blogs.)