Re: [Zope] how to call an external module from a Python script?
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
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. You bind the "namespace". This binding is there for precisely this aim....
Dieter
participants (2)
-
Dieter Maurer -
Reif Peter