[Zope-dev] __before_publishing_traverse__
calls RESPONSE.redirect(): is there another way to change the browser URL?
Andreas Kostyrka
andreas@kostyrka.priv.at
28 Sep 2002 08:11:13 +0200
Am Sam, 2002-09-28 um 05.35 schrieb Craeg K Strong:
> Sorry for the non-sequitur.. I do not really know if Zope uses the urllib2
> machinery or not. Somewhere, however, there must be some code that catches
>
> raise 'Redirect', myurl
Well, it's just send a response to the browser.
You thing it's like this:
client -> server obj -> server obj2 -> client
In fact it's:
client -> server obj -> client
client -> server obj2 -> client
>
> and does the appropriate thing (creates a new request, etc.).
>
> My "find-grep" caught class HTTPRedirectHandler(BaseHandler): (line 427 of
> urllib2.py)
>
> But I have not looked into it enough to understand whether it is what
> I am guessing it is, and-- even if so-- whether Zope uses it or not.
Nope it is not what you guess.
>
> in any event, there are other, better solutions on the table, so at this point
> it is no longer important...
>
> >
> >>Today, that code creates a new REQUEST object, throwing away the old request.
> >>I could cause it to insert some value that I would then test for,
> >>to distinguish the two cases.
> >
> > REQUEST.redirect sends a status code to the browser which then requests
> > the new URL by itself, ...
> >
> >>That would be the king of all hacks, but it might work :-}
> >
> > Probably not. The only thing you can do with redirect is to urlencode
> > your parameters, ...
>
> You're probably right. The browser is getting back a status code in the HTTP
> header that makes it generate a new request. The question I had was: would
> there be a way to stuff something in the HTTP header that the browser would
> somehow copy over to the new HTTP header it sends back in response to the
> redirect status code...?
Cookies (if enabled). GET style parameters appended to the URL.
Problem with GET and actions is, that the HTTP spec allow the client to
request it more than once. That's way at least netscape asks before
rePOSTing an URL while it reloads a GET URL without user interference.
Actually the HTTP spec allow an browser to get an url repeatedly for any
reasons. This is the HUGE semantic difference between GET/POST. (And not
that the parameters are passed via the url or stdin, ...)
Andreas
--
Andreas Kostyrka <andreas@kostyrka.priv.at>