ZPT to Python(script) to a different page
Newbie requests Style help please... I have a ZopePageTemplate containing a form. The action of the form points back to itself. This puts the user in a loop. At the top of the form, a tal:define statement calls a python script to perform validation and decision making logic. If the validation fails, as it will on the first ZPT rendering, the script returns the validation errors and the user is still on the originating ZPT containing the form. If the validation fails, due to bad input, the script returns the validation errors and the user is still on the originating ZPT. If the validation passes, I would like the user's browser to display different ZPTs based on the script's decision logic. What are the various means for the python script to cause the user's browser to display a new ZPT/zope object/html page? Or should I pass back to the ZPT and write tal:condition tags? Then what are the various means for the ZPT to cause the user's browser to display a new ZPT/zope object/html page? Can I simulate a user clicking on a link? thanks in advance
If the validation passes, I would like the user's browser to display different ZPTs based on the script's decision logic.
Try to use redirect. In case of error you return an error message; why in case of succes you don't follow this way?: return r.RESPONSE.redirect('success.html') ( where r = context.REQUEST )
thanks in advance
Hope this helps. Paolo
On Fri, Jul 18, 2003 at 08:59:03AM +0200, Paolo Dina wrote:
If the validation passes, I would like the user's browser to display different ZPTs based on the script's decision logic.
Try to use redirect.
In case of error you return an error message; why in case of succes you don't follow this way?:
return r.RESPONSE.redirect('success.html') ( where r = context.REQUEST )
actually, with RESPONSE.redirect, you don't need to return anything. It doesn't hurt, but it doesn't do anything either :) -- Paul Winkler http://www.slinkp.com Look! Up in the sky! It's ANCIENT PUNISHER! (random hero from isometric.spaceninja.com)
AdvertisingDept wrote:
Newbie requests Style help please...
[snip] What I'd do is actually have a Python Script being the driver for all this...
If the validation fails, as it will on the first ZPT rendering, the script returns the validation errors and the user is still on the originating ZPT containing the form.
Here the python script returns the ZPT form with something like: return context.your_form()
If the validation fails, due to bad input, the script returns the validation errors and the user is still on the originating ZPT.
Likewise here: return context.your_form()
If the validation passes, I would like the user's browser to display different ZPTs based on the script's decision logic.
And here you can do your other ZPTS: return context.your_other_zpt() ...just have your form submit to the python script :-) cheers, Chris
participants (4)
-
AdvertisingDept -
Chris Withers -
Paolo Dina -
Paul Winkler