[Zope] dtml-var calling python script.
Pavel Zaitsev
pavel@md5.ca
Mon, 10 Mar 2003 02:09:22 -0800
Hi,
I have a python script(pyfoo) that expects 2 parameters foo1 and foo2.
I'd like to invoke the script from a dtml code.
So dtmlfoo is:
-----------------------------------
<dtml-var pyfoo>
-----------------------------------
my pyfoo is:
-----------------------------------
## Script (Python) "pyfoo"
##bind container=container
##bind context=context
##bind namespace=
##bind script=script
##bind subpath=traverse_subpath
##parameters=foo1,foo2
##title=
##
# Example code:
# Import a standard function, and get the HTML request and response objects.
from Products.PythonScripts.standard import html_quote
request = container.REQUEST
RESPONSE = request.RESPONSE
print foo1,'|',foo2,"</br>";
return printed
-----------------------------------
Now, i place dtmlfoo in: /folder and place pyfoo in folder /folder/somewhere/there
so i do invoke dtmlfoo:
http://md5.ca/folder/somewhere/there/dtmlfoo?foo1=hello&foo2=world
What I get is error, specifying that pyfoo expects 2 parameters, and i provided none.
So.... i go to dtmlfoo, and change it like so:
<dtml-call pyfoo>
I do same invocation, it obviously works. Except that call does not expand into hello, world</br>,
which is normal.
How can I get <dtml-var> to behave like dtml-call, as with respect to inhereting parameters from caller
to callee?
I already devised a workaround, for my current problem but its ugly, using dtml-in and other things...
Any help is appreciated.
p.
--
Create like god, rule like a king, work like a slave.