[Zope] How do I call DTML Method which name is stored in a variable
Carlos Henrique Bauer
bauer@atlas.unisinos.br
Mon, 13 Dec 1999 08:00:08 -0200
On Fri, 10 Dec 1999, you wrote:
> 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'?
No. The variable contains the name of the method I want to call and which
must receive some arguments and return a value, for example:
<dtml-call "REQUEST.set('doc', fetchObj(_.None, _, fetchStr=docPath))">
<dtml-call "REQUEST.set('metaMethod', _.string.join(_.string.split(_.render(doc.meta_type)[0:])''))">
<dtml-call "REQUEST.set('metaMethod', _.string.join([metaMethod, 'GetMetaInfo' ], ''))">
If docPath points to a DTMLDocument, metaMethod becomes
"DTMLDocumentGetMetaInfo".
I'm trying to do something like this (it didn't worked for me):
<dtml-let something="_[metaMethod].(_.None, _,fetchStr=docPath)">
</dtml-let>
Best regards,
--
Carlos Henrique Bauer