Ticket #10267: 10267.diff
File 10267.diff, 1.5 KB (added by , 16 years ago) |
---|
-
django/views/generic/simple.py
1 1 from django.template import loader, RequestContext 2 2 from django.http import HttpResponse, HttpResponseRedirect, HttpResponsePermanentRedirect, HttpResponseGone 3 from django.utils.encoding import iri_to_url 3 4 4 5 def direct_to_template(request, template, extra_context=None, mimetype=None, **kwargs): 5 6 """ … … 36 37 """ 37 38 if url is not None: 38 39 klass = permanent and HttpResponsePermanentRedirect or HttpResponseRedirect 39 return klass( url % kwargs)40 return klass(iri_to_url(url % kwargs)) 40 41 else: 41 42 return HttpResponseGone() -
django/contrib/redirects/middleware.py
1 1 from django.contrib.redirects.models import Redirect 2 from django.utils.encoding import iri_to_url 2 3 from django import http 3 4 from django.conf import settings 4 5 … … 21 22 if r is not None: 22 23 if r.new_path == '': 23 24 return http.HttpResponseGone() 24 return http.HttpResponsePermanentRedirect( r.new_path)25 return http.HttpResponsePermanentRedirect(iri_to_url(r.new_path)) 25 26 26 27 # No redirect was found. Return the response. 27 28 return response