durusmail: quixote-users: http_request.py:HTTPRequest.redirect bug?
http_request.py:HTTPRequest.redirect bug?
2002-07-26
2002-08-05
http_request.py:HTTPRequest.redirect bug?
Greg Ward
2002-08-05
On 25 July 2002, Andreas Kostyrka said:
> As request.redirect doesn't seem to support relative urls, I've
> developed a small fix that seems to work quite well:
>
> import quixote.http_request
> import urlparse
>
> def redirect(self,location,permanent=0):
>     location=urlparse.urljoin(self.get_url(),location)
>     return self.response.redirect(location,permanent)

Andreas --

sorry for the delay; I finally dug into this a bit, and you are exactly
right.  The old HTTPRequest.redirect() method was pretty dumb, and your
version is much better, since it handles all three flavours of URLs
(absolute, hostless-absolute, and relative).

I'm going to check your version in now.  Thanks!

        Greg
--
Greg Ward - software developer                gward@mems-exchange.org
MEMS Exchange                            http://www.mems-exchange.org


reply