[Zope] How do I call DTML Method which name is stored in a variable

Evan Simpson evan@4-am.com
Fri, 10 Dec 1999 14:03:15 -0600


Carlos Henrique Bauer wrote:

> Thanks to Evan Simpson, I learned a method can be called in the following way:
>         <dtml-var expr="_.render(FetchObj(_.None, _,fetchStr='hie/dee/hoe').id)">
>
> Suppose the name of the method is stored in a variable. How do I invoke the
> method?

Hmm.  Did you mean your variable (let's call it 'v') contains 'hie/dee/hoe', or
'id'?

If the former, <dtml-var expr="_.render(FetchObj(_.None, _,fetchStr=v).id)">

If the latter, <dtml-with expr="FetchObj(_.None,
_,fetchStr='hie/dee/hoe')"><dtml-var expr="_[v]"></dtml-with>
is probably best.

Frankly, I hate jumping through these hoops, and I'll probably extend dtml-var one
of these days so we can just write:

<dtml-var id of=hie/dee/hoe> or <dtml-var expr="v" of="objectname">

Cheers,

Evan @ 4-am