[Zope] how to call an external module from a Python script?

Reif Peter gal@adv.magwien.gv.at
Mon, 24 Sep 2001 12:24:55 +0200


> Von: Paul Winkler *EXTERN* [mailto:slinkp23@yahoo.com]
> 
> On Fri, Sep 21, 2001 at 02:42:15PM +0200, Reif Peter wrote:
> > I defined an external method "build_adn" which I can call from a
> > DTML-document.
> > How do I call it from a Python script?
> > 
> > I tried e.g. "return build_adn (zone)", but it did not work.
> 
> The script needs to know what namespace to look in. To tell it to look
> up build_adn in the calling context (the folder or object from which
> you called the script), do this:
> 
>   return context.build_adn(zone)
> 
> The available namespaces (context, container, script,
> traverse_subpath) are described in the Zope Book. Go to the chapter on
> "Advanced Zope Scripts", section "Using Python-based Scripts", item
> "Binding Variables".
> 
And how do I call a DTML-variable (object?) defined with <dtml-let var=...>
from my script?
context.var, container.var, script.var don't work.
I want to get the variable's value regardless if it is defined via dtml-let
or set within the request (from an HTML form).

Peter