[Zope] problem calling a Python external method in a folder from a DTML method

Jim Anderson ezjab at ieee.org
Wed Mar 10 11:06:36 EST 2004


Paul Winkler wrote:

Paul, thanks for the input.

>On Wed, Mar 10, 2004 at 01:03:43AM -0500, Jim Anderson wrote:
>
>>I'm working on a DTML method in which I want to
>>call an external method in a folder, 'F'. F is a subdirectory
>>of the directory in which the DTML resides. The method,
>>'M', is in an external module 'M.py', so the path from
>>the current folder is 'F/M'.
>>
>
>Just to be sure you know this... that is a non-sequitur.
>The fact that M is an External Method has nothing to
>do with the path at which you can call it.
>

Maybe this is part of my problem, but it seems like the path to the 
external method is
relevant. Zope must find the external method to run it. Normally, this 
would be through
acquisition, but since the method is in a subdirectory of the DTML 
method referring to
it, I have used the <dtml-with> to push the namespace of folder F on to 
the namespace
stack.

Two things confuse me more.

First, there is no error message at all. There
are a couple of possibilities. With a statement like,
    <dtml-var expr="F.M()">
maybe Zope does not consider this an external method reference? It seems 
like it
should, but maybe it doesn't. The syntax I used looks identical to 
syntax that I've
see in the Zope Book and Zope Bible. Interestingly, when I remove the
external method M, the DTML runs the same, implying the Zope never
looked for M to begin with.

Second, why does it find 'F.sample' a property of F, but not the external
method M in F? Clearly, F is on the namespace stack.


>
>
>>My folder has a property,
>>"Sample", with a value of "Sample Text". The method,
>>M, returns a string value, "M method".
>>
>
>Given the remainder of your message, I am suspicious that
>your method returns anything at all.
>
When I run the test tab in the external method, the return value of the 
method gets rendered
by Zope. This is not the problem.

>
>
>Did you test the "M" external method directly in the ZMI?
>see the "Using External Methods" section of this chapter:
>http://zope.org/Documentation/Books/ZopeBook/2_6Edition/ScriptingZope.stx ?
>






More information about the Zope mailing list