[Zope] indirect calling of methods with parameters
Bernd Worsch
Bernd Worsch <bernd.worsch@frontsite.de>
Tue, 27 Mar 2001 18:59:45 +0200
On Tue, Mar 27, 2001 at 09:23:53AM -0700, Casey Duncan wrote:
>
> <dtml-var expr="_.getitem(method)(params)">
>
> If you wanted the parameter list to be variable as well, you could try
> passing a dictionary like so:
>
> <dtml-let params="{'arg1':value1, 'arg2':value2, ...}">
> <dtml-var expr="_.getitem(method)(kw=params)">
> </dtml-let>
>
> The params dictionary could be set anywhere before the actual call or
> even passed whole as a parameter to the calling method.
Ahhhh! Ok, i simply didn't recognize that getitem allows to pass parameters.
This hint provided, i solved my problem like this:
<dtml-let method="'SomeMethod'"
para1="'FirstArgument'"
para2="'SecondArgument'">
<dtml-var expr="_.getitem(method)(para1, para2)"><br>
</dtml-let>
I somehow failed to achive the same by using a parameter dictionary as
you suggested. Nevertheless i'm REALLY grateful for you braking my deadlock
of thought! Btw i couldn't find to many docs on using getitem like this!
Could be i was to dumb looking for it, but i'm quite sure it is neither
in Zope Book nor in the Howto on Advanced Scripting. (Not to mention
the online help). I'll be preparing a supplement and try not include
to much nonsense. If anybody whishes to review or contribute i could
put the supplement on zwiki.org before sending it to someone to add it
to the documentation.
--
-----Bernd Worsch-----------bernd.worsch@frontsite.de--------