[Zope] The RESPONSE object

Casey Duncan cduncan@kaivo.com
Wed, 21 Mar 2001 09:22:09 -0700


Peter Sabaini wrote:
> 
> i didnt find a set() method in the source of
> lib/python/Products/OFSP/help/Response.py, i think that may be a bug
> in the ZQR. (disclaimer: i've got zope v2.2.4, maybe it was added
> later on).
> 
> i doubt that setting a variable in the REQUEST object with
> 
>   <dtml-call REQUEST.set('myVariable', myVariableValue)">
> 
> can be used to pass data across a redirect (but you can try this
> easily).
> 
> i would use some kind of session manager to do this, or you could
> hack your redirect url to look something like
> '/SomeDtmlMethod?var=value'...
> 
>  - peter.
> 
> On Wed, 21 Mar 2001, Karl Munroe wrote:
> 
> > The Zope Quick Reference version 0.9 lists the RESPONSE variable as having
> > an attribute "set(name, value)" that sets a variable in the request.
> >
> > I tried to use this method to set some variables and the redirct like so:
> >
> > <dtml-call "RESPONSE.set('myVariable', myVariableValue)">
> > <dtml-call "RESPONSE.redirect(URL1+'/SomeDtmlMethod')">
> >
> > When I execute the above code I get the following error message
> >
> > Error Type: AttributeError
> > Error Value: set
> >
> > What I would like to achieve is an automatic redirect with my submitted form
> > variable in the new request.
> >

RESPONSE.set is an ancient artifact that is merely exposing the out of
date nature of the ZQR. At any rate the problem you are running up
against is the stateless nature of HTML. There are several ways to
accomplish your goal:

1. Pass the values again by populating hidden fields on a form and
submitting the form.
2. Pass the values by explicitly rewriting URLs with the variable/values
you want.
2. Store the values in a Cookie.
3. Use a session management tool. There are several available for Zope.

-- 
| Casey Duncan
| Kaivo, Inc.
| cduncan@kaivo.com
`------------------>