[Zope] Indirect calling of extensions?

Glenn Rogers zope-list@gacela.demon.co.uk
Sat, 25 Mar 2000 02:10:40 +0000


On Fri, Mar 24, 2000 at 03:28:09PM -0600, Tres Seaver wrote:
> Glenn Rogers <zope-list@gacela.demon.co.uk> wrote:
> 
> > Imagine I have a python extension, with zope id pyFetch
> > 
> >   def Fetch (self, href):
> >     ...
> > 
> > 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-->
> > 
> 
> I don't know what you mean by "python extension" -- is this an ExternalMethod?
>
Yes.  It lives in the zope extensions directory though - blame lack of sleep.

> In a DTML method contained/acquired by that folder::
> 
>   <ul>
>   <dtml-in list_hrefs mapping> 
>     <li><dtml-var "this().pyFetch( href )"></li>
>   </dtml-in>
>   </ul>
>
Problem: In real life, I don't know that I'm calling pyFetch, it could be 
pyDontFetch or pyGoToSleep etc (the "#let call_method" is in another DTML 
method and there are a few alternatives).  All I know is that it shares 
the same signature.  Works fine if you call it directly.

Is there a better method than the equivalent of

  <!--#if "call_method=='pyFetch'"-->
    <!--#var pyFetch( href )-->
  <!--#elif "call_method=='pyDontFetch'"-->
    <!--#var pyDontFetch( href )-->
  ...


Thanks

Glenn