[ZPT] Re: zope objects
Evan Simpson
evan at 4-am.com
Tue May 20 11:11:43 EDT 2003
James Webster wrote:
> form submitted --> script process chooses SQL method to call --> SQL
> method selects data using user criterion --> page template renders data
> from SQL method.
Have the "action" attribute of your form point to the Script. It might
look like this:
## Script (Python) "handle_form"
##parameters=field1
if field1:
recs = container['query1.sql']()
elif phone:
recs = container['query2.sql']()
return container['result.zpt'](recs=recs)
You then use tal:repeat="rec options/recs" to iterate over the SQL
results in the ZPT. Note that you don't need to explicitly pass the
form variables to either of the SQL Methods, since they will
automatically find them in the REQUEST.
Cheers,
Evan @ 4-am
More information about the ZPT
mailing list