Forms, RESPONSE, REQUEST, and redirect
It has been a long day... So, I have been trying to bend Zope to my will and making some progress. But this one has me a bit befuddled either because I'm tired or because I am missing something. Here's what I am trying to do... I have a method (in the particular case at hand, it is an External Method, but it could be a Python Script or DTML). It gets control, gets access to its REQUEST and RESONSE objects and does something. In particular, it arranges some computation and modifies some REQUEST values, and possibly adds some new ones. It then redirects to another object, this time a DTML document which, when it renders, will want access to the initial REQUEST object data as modified. To make things explict: If I make a form which has a form variable 'a', that variable is visible at my script. I can also create a new variable 'b' and put it in the REQUEST object with a REQUEST.set(name,value) call. But, when I direct from the script to another script (in this case, the original form), the REQUEST object does not include these values. If I then change the form action to not go to the script but to simply return to the form, the form renders itself (without the data mods my script was supposed to provide) since it has a copy of the REQUEST object that includes the form variables. Bottom line, how does one trick ZPublisher into marshalling some or all of the name-item pairs on redirection. Thanks for help.
Dennis Allison wrote:
It has been a long day...
So, I have been trying to bend Zope to my will and making some progress. But this one has me a bit befuddled either because I'm tired or because I am missing something.
Here's what I am trying to do...
I have a method (in the particular case at hand, it is an External Method, but it could be a Python Script or DTML). It gets control, gets access to its REQUEST and RESONSE objects and does something. In particular, it arranges some computation and modifies some REQUEST values, and possibly adds some new ones. It then redirects to another object, this time a DTML document which, when it renders, will want access to the initial REQUEST object data as modified.
I suspect you should take a look at Dieter Maurers FormDispatcher product. http://www.handshake.de/~dieter/pyprojects/zope/Dispatcher.html cheers, oliver
do you use RESPONSE.redirect to redirect to another page ? if so, than a new REQUEST is made, and your old variables are lost. check REQUEST.SESSION if you want to have variables persistent among request Michal On Mon, May 06, 2002 at 02:58:37AM -0700, Dennis Allison wrote:
If I make a form which has a form variable 'a', that variable is visible at my script. I can also create a new variable 'b' and put it in the REQUEST object with a REQUEST.set(name,value) call. But, when I direct from the script to another script (in this case, the original form), the REQUEST object does not include these values.
Dennis Allison writes:
So, I have been trying to bend Zope to my will and making some progress. But this one has me a bit befuddled either because I'm tired or because I am missing something.
Here's what I am trying to do...
I have a method (in the particular case at hand, it is an External Method, but it could be a Python Script or DTML). It gets control, gets access to its REQUEST and RESONSE objects and does something. In particular, it arranges some computation and modifies some REQUEST values, and possibly adds some new ones. It then redirects to another object, this time a DTML document which, when it renders, will want access to the initial REQUEST object data as modified. When you use "RESPONSE.redirect", you go back to the browser, the browser makes a new request and this does not know anything about the previous one.
Your options: * a session object * "emulateRedirect" from <http://www.dieter.handshake.de/pyprojects/zope> Dieter
participants (4)
-
Dennis Allison -
Dieter Maurer -
Michal Bencur -
Oliver Bleutgen