[Zope] referencing title value as a var name

Casey Duncan cduncan@kaivo.com
Tue, 14 Aug 2001 08:28:08 -0600


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
`------------------>