Am Fre, 2002-07-26 um 16.23 schrieb Greg Ward: > 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? self.get_url() == "http://localhost/~andreas/test.cgi/login" location="fax/" If your would write it in a the browser would send you to http://localhost/~andreas/test.cgi/fax/ The old code sends you to http://localhostfax/ Basically there are 3 ways to specify urls: absolute with host http://host/url absolute without host /url relative url The old code deals with the first 2 cases, but in my experience relative urls are quite important. ;) > > > 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. See above. Andreas