Hi! Please consider this TALES expression: <div class="DataPrevista" tal:content='here/getDataInici | string: nosta' /> If I try this other: <div tal:content='string:${here/getDataInici}' /> the result is <div>None</div> Then the first one will render the alternate expression isn't it? Then with it renders <div class="DataPrevista" /> ? Thanks! -- Mis Cosas http://blogs.sistes.net/Garito Zope Smart Manager http://blogs.sistes.net/Garito/670
Hi! Please consider this TALES expression:
<div class="DataPrevista" tal:content='here/getDataInici | string: nosta' />
If I try this other: <div tal:content='string:${here/getDataInici}' /> the result is <div>None</div>
Then the first one will render the alternate expression isn't it?
Then with it renders <div class="DataPrevista" /> ?
Thanks!
I don't understand what you are asking. Could you describe your question more clear please. Martijn. -- Martijn Jacobs Four Digits, Internet Solutions a: Willemsplein 15-1 6811 KB Arnhem NL kvk: 091621370000 | btw: 8161.22.234.B01 e-mail: martijn@fourdigits.nl | web: http://www.fourdigits.nl tel: +31 (0)26 44 22 700 | fax: +31 (0)84 22 06 117
Garito wrote:
Hi! Please consider this TALES expression:
<div class="DataPrevista" tal:content='here/getDataInici | string: nosta' />
If I try this other: <div tal:content='string:${here/getDataInici}' /> the result is <div>None</div>
Then the first one will render the alternate expression isn't it?
Then with it renders <div class="DataPrevista" /> ?
Сто? ;-) You should check the tales documentation. the pipe symbol | means a logical "or", in effect if the left expression resolves to "non existent", None, empty object,... (generally python False) the right part of it is evaluated. In the special case it probably is nicer to use: <div class="DataPrevista" tal:content="here/getDataInici | default">nosta</div> instead so the fallback value is part of the template (TAL is meant to be design by example) I would also recommend not mixing " and ' for attributes and maybe in the long run sticking to english language names for your objects makes it easier to ask on mailinglists. Regards Tino
On Wed, Jul 16, 2008 at 6:34 AM, Tino Wildenhain <tino@wildenhain.de> wrote:
You should check the tales documentation. the pipe symbol | means a logical "or", in effect if the left expression resolves to "non existent", None, empty object,... (generally python False) the right part of it is evaluated.
Not at all. The pipe uses the left-hand operand if it is defined; a value of None or an empty string is still a defined value. As long as "here" can be traversed with the name "getDataInici" then the left-hand expression will be used. If that traversal fails the right-hand expression will be used instead. -Fred -- Fred L. Drake, Jr. <fdrake at gmail.com> "Chaos is the score upon which reality is written." --Henry Miller
Fred Drake wrote:
On Wed, Jul 16, 2008 at 6:34 AM, Tino Wildenhain <tino@wildenhain.de> wrote:
You should check the tales documentation. the pipe symbol | means a logical "or", in effect if the left expression resolves to "non existent", None, empty object,... (generally python False) the right part of it is evaluated.
Not at all.
The pipe uses the left-hand operand if it is defined; a value of None or an empty string is still a defined value. As long as "here" can be traversed with the name "getDataInici" then the left-hand expression will be used. If that traversal fails the right-hand expression will be used instead.
Indeed :-) Cheers Tino
participants (4)
-
Fred Drake -
Garito -
Martijn Jacobs -
Tino Wildenhain