[Zope] dtml-var calling python script.

Dylan Reinhardt zope@dylanreinhardt.com
Mon, 10 Mar 2003 13:11:14 -0800


At 12:50 PM 3/10/2003, Pavel Zaitsev wrote:
>Dylan Reinhardt(zope@dylanreinhardt.com)@Mon, Mar 10, 2003 at 09:03:38AM 
>-0800:
> > >I have a python script(pyfoo) that expects 2 parameters foo1 and foo2.
> > >I'd like to invoke the script from a dtml code.
> > <dtml-var "pyfoo(foo1, foo2)">
>
>Actually what I want the python script to do is, to inherit variables from
>REQUEST, like it does when invoked directly from the web.

Ah.  In that case, you can get them like this:

context.REQUEST['foo1']

when you call pyfoo as:

<dtml-var pyfoo>

and call dtmlfoo as:

dtmlfoo?foo1=something

Naturally, you'll want to do some exception handling, etc.  But that's the 
basic technique.

HTH,

Dylan