[ZPT] zpt + python + variables
Ian Bicking
ianb at colorstudy.com
Wed May 5 11:50:18 EDT 2004
Michael Bond wrote:
>
> I have a zpt form, where I am generating some of the input fields on the
> fly in the zpt. Not only will the names of the field change, but the
> number of fields will change as well.
>
> The action attribute points to a python script, however everything dies
> at this point because the python script needs an expected number of
> parameters and complains if it doesn't have exactly that.
>
> What is the best way to handle a problem like this? Is there a way to
> ignore the parameter's list in the script definition and have the zpt
> send something else through to the script (perhaps a dict.)?
A Python script doesn't have to specify every named parameter. If it
receives extra parameters (through the form) it will ignore them. Then
you can get to the parameters through container.REQUEST.get(field_name),
e.g., container.REQUEST.get('phone_1')
Ian
More information about the ZPT
mailing list