[Zope] Newbie: need a simple example of external method

Pavlos Christoforou pavlos@gaaros.msrc.sunysb.edu
Wed, 13 Oct 1999 16:57:16 -0400 (EDT)


Welcome -

On Wed, 13 Oct 1999, Hung Jung Lu wrote:

> 
> myprogram.py:
> 
> def myfunc(x):
>     return 2*x;
> 
> How do I proceed to use it in DTML, and how do I 
> place it in the external methods folder?

First go in your Zope management screen and select external method from
the available object list.


Add an id (lets say testit) add the function name (in your case myfunc)
and then the python module file (which should exist in the Extensions
directory in the main python distribution. In your case myprogram.py)

click add and that's about it.

In a DTML method you can call your function by simply calling:

<dtml-var "testit(3)">
should print out 6



Pavlos