durusmail: qp: cookies and redirects
cookies and redirects
2005-12-12
2005-12-12
2005-12-12
2005-12-13
2005-12-13
2005-12-13
2005-12-13
2005-12-13
cookies and redirects
mario ruggier
2005-12-13
On Dec 13, 2005, at 2:33 AM, David Binger wrote:
> On Dec 12, 2005, at 6:01 PM, mario ruggier wrote:
>> On Dec 12, 2005, at 2:56 PM, mario ruggier wrote:
>>> I would like that when a specific url is requested it sets a cookie
>>> then redirects to the referring url. However, redirection of a
>>> request causes the response to be re-initialized, and so cookies
>>> added to the response are lost. Am I missing something?
>>
>> I guess this would be the give part of the give'n'take deal for the
>> RespondNow convenience in so many other places. If I do the response
>> setup myself, so not calling publiser.redirect(), the above works
>> fine... except that I am obliged to then redirect twice to return the
>> referrer page after setting the cookie, which I guess is fine
>> although not sure if this means potential new problems in some cases.
>
> Are you saying that you
> set the location, cookie, and status and respond_now(),
> and you must then redirect *again*?
> Why is that?

Sorry, was not very clear... in my unrelenting quest to be as lazy as
possible, on which I work very hard ;), I was trying to avoid
redirecting "manually" and insisting on using pubisher.redirect()...
but as this inits the response it forces some ugly contortions, and
double redirection, to achieve what i wanted -- but details of this bad
idea are really not interesting. Doing the redirect manually as you
outline works just fine, and just as it used to with quixote's
Redirector.

>> I wonder if it might be generally useful to have a redirect that does
>> not initialize the response from scratch? Are there other use cases
>> that fall into this scenario?
>
> None here.

Just to clarify... are there ever any situations where from any given
page you want to "set" something (that involves attaching some info to
the response headers -- e.g. sign_out does not fit this case as it does
everything only server-side) and come back to the page, taking the new
"setting" into account ? In my case I am setting a preferred language
cookie... What would the arguments be against a init_response=True
param to pub.redirect() ?

mario

reply