[Zope] Re: tal expression
Garito
garito at sistes.net
Sat Nov 6 09:11:11 EST 2004
Duncan Booth wrote:
>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?
>>>
>>>Thank you!!!
>>>
>>>
>>>
>>Now I have a correct expression (thanks to Chema Cortés from spanish
>>zope list). This is the expression:
>>
>>(len(dictionary['value1'])>6 and dictionary['value1'][5]) or 'Value
>>not available'
>>
>>Thanks for all your help!!!
>>
>>
>
>An alternative that should work (although it is untested):
>
><tal:b replace="dictionary/value1/5|string:Value not available" />
>
>
>_______________________________________________
>Zope maillist - Zope at zope.org
>http://mail.zope.org/mailman/listinfo/zope
>** No cross posts or HTML encoding! **
>(Related lists -
> http://mail.zope.org/mailman/listinfo/zope-announce
> http://mail.zope.org/mailman/listinfo/zope-dev )
>
>
Sorry but your solution doesn't work (Value not available in all cases)
I think these work with an array like:
{"value1": {"1": "One", "2": "Two", "5": "Five"}}
But thanks!
More information about the Zope
mailing list