[Zope] Form action with Python script and arguments

Cliff Ford Cliff.Ford at ed.ac.uk
Mon Mar 7 08:06:18 EST 2005


You could pass the extra argument to the form in a hidden field:

<FORM action="my_py_script" method="post">
<input type="hidden" name="arg" value="<dtml-var argval>">

Assuming you are talking about a python script added with the ZMI you 
get the form parameters from the REQUEST object:

argValue=context.REQUEST.arg

HTH

Cliff

Henk Jansen wrote:
> I have two problems when I want for pass <FORM ...> information into a
> Python Script:
> 
> 1) Besides passing the FORM data, I also need to pass an extra argument
> into the Python script that was passed (as <URL>?arg=argval) by the URL.
> A thing like:
> 
>      <FORM action=my_py_script(arg=<dtml-var argval>)
> 
> doesn't work. Neither does:
> 
>      <FORM action="my_py_script(arg=<dtml-var argval>")
> 
> What's the proper syntax for passing extra arguments to a Python script
> in a FORM action?
> 
> 2) How do I access the FORM data in a Python script? I've tried "import
> cgi" but a call to cgi.FieldStorage() was met by a message that I wasn't
> authorized to make this call ...
> 
> Thanks,
> 
> --Henk
> _______________________________________________
> Zope maillist  -  Zope at 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 )


More information about the Zope mailing list