[ZPT] zope objects

Santi Camps santicamps at wanadoo.es
Tue May 20 17:02:23 EDT 2003


> Please excuse if this isn't the right list for this problem.  It is 
> partly a question of most of the documentation still relating to DTML, 
> whereas I'm keen to use Page Templates.
> 
> I'm working on small app. which starts with a form which allows the user 
> to choose some criteria which will form the basis of an SQL method (e.g. 
> number of records to select).  I've got the form template working fine 
> and an SQL method working as I want it.  However, I need to process the 
> parameters passed from the form in a python script.  For example, if the 
> user chooses to search for last names, a different SQL method is called 
> from when he or she chooses to search for first names.
> 
> I think I can write the script (though I'm very much a python and zope 
> newbie).  However, I can't quite see how to connect the objects so that 
> the process works like this:
> 
> form submitted --> script process chooses SQL method to call --> SQL 
> method selects data using user criterion --> page template renders data 
> from SQL method.
> 
> Any ideas?
> 
> James
> 

If you want to have a render page template for each SQL Method, the
process could be:

form submitted --> script process chooses SQL method to call --> page template renders data 
from SQL method.

And the call to SQL method could be done in a <sometag
tal:repeat="record sql_method_to_call"> inside de rendering page
template

The only special issue you should know is that a
context.REQUEST.RESPONSE.redirect('render_page_template') in the python
script will not pass the form data to the render page template.  If you
need this form data in the SQL Method, you should make a call to the
page templade, not just a redirect, inside the python script, something
like: return context.name_of_render_page_template()

I hope this could help you

Santi Camps









More information about the ZPT mailing list