[Zope] Re: Indirect calling of extensions

Glenn Rogers glenn@systems-options.co.uk
Mon, 27 Mar 2000 12:08:43 +0100


I wrote:
> > I want to call this in a manner similar to:
> >
> >   <!--#let call_method="'pyFetch'"-->
> >     <!--#in sql-method-returns-href-->
> >       <!--#var "_[call_method]( href )"-->
> >     <!--#/in-->
> >   <!--#/let--> 

Tres Seaver wrote:
> Try this (untested), assuming the name of the method you want to call
> is stored somehow in the variable 'methodName'::
>
>  <dtml-let methodToCall="_[ methodName ]">
>    <dtml-in list_hrefs mapping>
>      <dtml-var "methodToCall( this(), href )">
>    </dtml-in>
>  </dtml-let>
>
Alas! It doesn't work.  It appears to fall down on the line:
  <dtml-let methodToCall="_[ methodName ]">

Traceback:
  File C:\PROGRA~1\Zope\lib\python\DocumentTemplate\DT_Let.py, 
      line 144, in render
      (Object: methodToCall=&quot;_[select_method]&quot;)
  File C:\PROGRA~1\Zope\lib\python\DocumentTemplate\DT_Util.py, 
      line 335, in eval
      (Object: _[select_method])
      (Info: select_method)
  File &lt;string&gt;, line 0, in ?
  File C:\PROGRA~1\Zope\lib\python\DocumentTemplate\DT_Util.py, 
      line 161, in careful_getitem
  File [snip]\Products\ExternalMethod\ExternalMethod.py,
      line 248, in __call__
      (Object: pyFetchInvTopicsForHref)
      (Info: ((), {}, None))
TypeError: (see above)
[above=  Error Type: TypeError
         Error Value: not enough arguments; expected 2, got 0 ]

It seems evaluating this doesn't just give the string contents of the
dictionary item, it evaluates the actual external method call.

I think I'll have to give up at this point and take the cludgy option
(unless anyone can think up another way).

Thanks for your help.


Glenn