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-07-26
On 25 July 2002, Andreas Kostyrka said:
> As request.redirect doesn't seem to support relative urls

That's funny, I thought it did (although inelegantly):

    def redirect (self, location, permanent=0):
        [...]
        if location.find("://") == -1:
            location = "%s://%s%s" % (self.scheme, self.get_server(), location)

Do you have a simple example of how/why this does not work?

> I've developed a small fix that seems to work quite well:
[...]
> def redirect(self,location,permanent=0):
>     location=urlparse.urljoin(self.get_url(),location)
>     return self.response.redirect(location,permanent)

That's a lot cleaner than our version, but I'd still like to see an
example to understand where ours is wrong.

Thanks --

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


reply