Ticket #987: absolute.diff
File absolute.diff, 816 bytes (added by , 18 years ago) |
---|
-
django/http/__init__.py
256 256 class HttpResponseRedirect(HttpResponse): 257 257 def __init__(self, redirect_to): 258 258 HttpResponse.__init__(self) 259 # use absolute path if the site framework has been configured 260 from django.contrib.sites.models import Site 261 mysite = Site.objects.all()[0] 262 if mysite.domain != 'example.com' and not redirect_to.startswith('http://'): 263 redirect_to = 'http://%s/%s' % (mysite.domain, redirect_to) 264 redirect_to = os.path.normpath(redirect_to) 259 265 self['Location'] = quote(redirect_to, safe=RESERVED_CHARS) 260 266 self.status_code = 302 261 267