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

Paul Winkler slinkp23@yahoo.com
Fri, 21 Sep 2001 12:29:13 -0400


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".

-- 
................    paul winkler   ................
 custom calendars:   http://www.calendargalaxy.com
   A member of ARMS:   http://www.reacharms.com
        home page:  http://www.slinkp.com