Ticket #987: absolute2.diff
File absolute2.diff, 1.0 KB (added by , 18 years ago) |
---|
-
django/http/__init__.py
3 3 from pprint import pformat 4 4 from urllib import urlencode, quote 5 5 from django.utils.datastructures import MultiValueDict 6 from django.conf import settings 6 7 7 8 RESERVED_CHARS="!*'();:@&=+$,/?%#[]" 8 9 … … 256 257 class HttpResponseRedirect(HttpResponse): 257 258 def __init__(self, redirect_to): 258 259 HttpResponse.__init__(self) 260 # use absolute path if the site framework has been configured 261 from django.contrib.sites.models import Site 262 mysite = Site.objects.get(pk=settings.SITE_ID) 263 if mysite.domain != 'example.com' and not redirect_to.startswith('http://'): 264 redirect_to = 'http://%s/%s' % (mysite.domain, redirect_to) 265 redirect_to = os.path.normpath(redirect_to) 259 266 self['Location'] = quote(redirect_to, safe=RESERVED_CHARS) 260 267 self.status_code = 302 261 268