[Zope] dtml: got variable name as string, how to get to variable?

Stephen Pitts smpitts@midsouth.rr.com
Mon, 24 Jan 2000 22:19:01 -0600


> etc. this is a bit repetitive. so i thought i'd save a bit of typing
> (well, actually i had a python snippet generate the above) and created
> a property (type "tokens", looks like a list of strings) listing the
> field names in the database and thought i'd do something like
> 
> <dtml-in fieldnames>
> <dtml-if ???>
>   <dtml-var sequence-item> ~* <dtml-sqlvar ??? type=string> and
> </dtml-if>
> </dtml-in>
> 1 = 1;
> 
> so in sequence-item i have the name of the variable i want, as a
> string. the question is: what do i put in ???, or, how do i get to the
> value of that variable?

Shouldn't <dtml-if _.has_key(fieldname)> work?
Then, to access the variable, you'd do <dtml-var "_[fieldname]">
-- 
Stephen Pitts
smpitts@midsouth.rr.com
webmaster - http://www.mschess.org