The whole point of my question was about getting parameters from the REQUEST object into Python scripts, so perhaps if I restate the example - I've got a DTML Document called hDoc: <form action="./hDoc" method="POST"> Name: <input type="text" name="name" value=""> <input type="submit" value="Submit"> </form> <dtml-if "REQUEST.get('REQUEST_METHOD') == 'POST'"> <dtml-var hello> </dtml-if> and a Python script - return "Hello %s!" % name According to the Zope Bible book this should work, but it doesn't. If I mod the DTML to - <form action="./hDoc" method="POST"> Name: <input type="text" name="name" value=""> <input type="submit" value="Submit"> </form> <dtml-if "REQUEST.get('REQUEST_METHOD') == 'POST'"> <dtml-var "hello(REQUEST.get('name'))"> </dtml-if> It works as expected. So the question is, I am doing something wrong or is the book wrong? "Dylan Reinhardt" <zope@dylanreinhardt.com> wrote in message news:1070469388.3233.51.camel@ida.dylanreinhardt.com...
On Wed, 2003-12-03 at 04:06, Mark Ferguson wrote:
I'm going through the code examples in the Zope Bible and I can't get the following to work:
I've created a Python(Script) called 'hello' with 'name' on the parameter list and the following script body - return "Hello %s!" % name
So far so good.
and a DTML Document with - <dtml-call "REQUEST.set('name', 'John')"> <dtml-var hello>
Although scripts *can* obtain variables from REQUEST, it is not the correct way to pass arguments. Try this:
<dtml-var "hello('John')">
-- or --
<dtml-call "REQUEST.set('name', hello('John'))"> <dtml-var name>
HTH,
Dylan
_______________________________________________ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )