[Zope] referencing title value as a var name

Tino Wildenhain tino@wildenhain.de
Tue, 14 Aug 2001 17:12:53 +0200


Hi Kerekes,

I think using a DTML document only as container
for a single string to look up is a bit overworked ;)
What about a single lines Property with the words you
want int the given order and then:

<dtml-var expr="StateProperty[STATE]">

This will work with integer as lookup.

Regards
Tino

--On Dienstag, 14. August 2001 08:28 -0600 Casey Duncan <cduncan@kaivo.com> wrote:

> Kerekes Lajos wrote:
>>
>> Hi!
>>
>> I have same problem. Could you help me?
>> This is the source:
>>
>> <dtml-in SelectState size=10 start=query_start>
>> <dtml-var expr="_['STATE']">
>> </dtml-in>
>>
>> SelectState is a ZSQL method, gives the STATE,
>> STATE is an integer, and there are three DTML
>> DOCUMENT (named 0, 1, 2) in the folder,  and these
>> objects contains the "state string" (for example "OK",
>> "Connection error" etc.)
>>
>> If I use the code above, I get only 0, 1 or 2, not the
>> state strings.
>>
>> I tried <dtml-var expr="_[STATE]"> too, but it gives
>> these erorrs.
>> Error Type: SystemError
>> Error Value: bad argument to internal function
>>
>>    Thank you:
>>
>>     Lajos  Kerekes
>
> I think that is because STATE is an integer, and _[ ] expects a string.
> try:
>
> <dtml-var expr="_[_.str(STATE)]">
>
> kinda messy looking, but it should work.
>
> hth,
> --
>| Casey Duncan
>| Kaivo, Inc.
>| cduncan@kaivo.com
> `------------------>
>
> _______________________________________________
> Zope maillist  -  Zope@zope.org
> http://lists.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists -
>  http://lists.zope.org/mailman/listinfo/zope-announce
>  http://lists.zope.org/mailman/listinfo/zope-dev )