[Zope] tal expression

Garito garito at sistes.net
Thu Nov 4 03:34:01 EST 2004


Andreas Jung wrote:

>
>
> --On Donnerstag, 4. November 2004 9:09 Uhr +0100 Garito 
> <garito at sistes.net> 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?
>>
>
> Please look at the Python Dictionary API, especially the has_key() or 
> get() method.
>
> -aj

Hi Andreas (Good morning!)
Thank you for your light speed response ;)
The get() method would be fantastic but my problem is with the list
I know that value1 exists in the dictionary but I don't know the length 
of the list
It would be perfect if I have some get method (with default value like 
dictionary's get) for the list

Another possibility will be some if sentence like expresion ? result for 
true : result for false Has python these kind of if?

Any idea?



More information about the Zope mailing list