Ticket #10267: 10267.diff

File 10267.diff, 1.5 KB (added by aljosa, 6 years ago)

added iri_to_uri (for files mentioned in comment #8)

  • django/views/generic/simple.py

     
    11from django.template import loader, RequestContext
    22from django.http import HttpResponse, HttpResponseRedirect, HttpResponsePermanentRedirect, HttpResponseGone
     3from django.utils.encoding import iri_to_url
    34
    45def direct_to_template(request, template, extra_context=None, mimetype=None, **kwargs):
    56    """
     
    3637    """
    3738    if url is not None:
    3839        klass = permanent and HttpResponsePermanentRedirect or HttpResponseRedirect
    39         return klass(url % kwargs)
     40        return klass(iri_to_url(url % kwargs))
    4041    else:
    4142        return HttpResponseGone()
  • django/contrib/redirects/middleware.py

     
    11from django.contrib.redirects.models import Redirect
     2from django.utils.encoding import iri_to_url
    23from django import http
    34from django.conf import settings
    45
     
    2122        if r is not None:
    2223            if r.new_path == '':
    2324                return http.HttpResponseGone()
    24             return http.HttpResponsePermanentRedirect(r.new_path)
     25            return http.HttpResponsePermanentRedirect(iri_to_url(r.new_path))
    2526
    2627        # No redirect was found. Return the response.
    2728        return response
Back to Top