[Zope] Re: tal expression

Michael Haubenwallner michael at d2m.at
Thu Nov 4 03:56:46 EST 2004


Garito wrote:

> Hi
> will these be possible?
> 
> <tal:b tal:define='dictionary python: {"value1": ["one", "two", 
> "three"], "value2": "two", "value3": "three"}'>
>    <tal:b tal:replace='python: dictionary["value1"][5] | "Value not 
> available"' />
> </tal:b>
> 
> Obviously these is an incorrect tal expression (the replace one) but 
> there are any way to create an expression like these and correct?
> 

You can use the TAL "on-error" handler:

     <tal:b tal:replace="python: dictionary['value1'][5]"
            tal:on-error="string:Value not available" />

see also your TAL online help:
http://localhost:8080/Control_Panel/Products/PageTemplates/Help/tal-on-error.stx

Michael

-- 
http://zope.org/Members/d2m




More information about the Zope mailing list