[Zope] Redirect with results of script to another ZPT
Chris Meyers
chris@hddesign.com
Tue, 20 Aug 2002 16:56:28 -0500
On Wed, Aug 21, 2002 at 12:14:51AM +0530, Chetan Kumar wrote:
> Hi all
> > The situation
> >
> > ------------------OneZPT------------------
> > <FORM action SomePythonScript>
> > selections
> > </FORM>
> > -----------------------------------------
> >
> > ---------------SomePythonSript-----
> > results=SomeSQL(pass selections from OneZPT>
> > RESPONSE.redirect(AnotherZPT)
> > -----------------------------------------
> >
> > I need to get the results in AnotherZPT.
> >
> > -------------AnotherZPT--------------
> > <table>
> > <tr somehow get the results from SomePythonScript
> > triggered by OneZPT>
> > <td>
> > display here
> > </td>
> > </tr>
> > </table>
> > -----------------------------------------
> > What is the way out ?
> >
> > This is a compromise solution for my requirements.
> > Earlier, I wanted to return the results to OneZPT
> > where I would have rendered. This seems to be
> > a bit tricky to me at this moment.
> >
> > TIA
> > Chetan
>
What I do is have the action for the form in OneZPT point to AnotherZPT. Then from AnotherZPT you can call SomePythonScript which will call the ZSQL method and do any data manipulation necessary, and then return the data to AnotherZPT. This works nicely because you get the benefit of having access to the REQUEST variables in both AnotherZPT and SomePythonScript without having to pass it around.
I think that you could use the same technique to return the result to OneZPT instead of AnotherZPT if that is what you really want to do. You could have the form action point to OneZPT and give the submit button of OneZPT a distinct name like hasbeensubmitted or something. Then set up a tal:condition to test for hasbeensubmitted. If it is there, call SomePythonScript to process the ZSQL and return the results to OneZPT and go on from there.
Hope that helps,
Chris
--
Chris Meyers
Huttleston Data Design
7941 Tree Lane Suite 200
Madison WI 53717