Ticket #6892: 6892v1.diff

File 6892v1.diff, 1.3 KB (added by daonb <bennydaon@…>, 16 years ago)

adding a call to iri_to_uri in redirect_to

  • django/views/generic/simple.py

     
    11from django.shortcuts import render_to_response
    22from django.template import loader, RequestContext
    33from django.http import HttpResponse, HttpResponsePermanentRedirect, HttpResponseGone
     4from django.utils.encoding import iri_to_uri
    45
    56def direct_to_template(request, template, extra_context=None, mimetype=None, **kwargs):
    67    """
     
    2223    """
    2324    Redirect to a given URL.
    2425
    25     The given url may contain dict-style string formatting, which will be
    26     interpolated against the params in the URL.  For example, to redirect from
     26    The given url may contain unicode characters as well as dict-style string formatting,
     27    which will be interpolated against the params in the URL.  For example, to redirect from
    2728    ``/foo/<id>/`` to ``/bar/<id>/``, you could use the following URLconf::
    2829
    2930        urlpatterns = patterns('',
     
    3334    If the given url is ``None``, a HttpResponseGone (410) will be issued.
    3435    """
    3536    if url is not None:
    36         return HttpResponsePermanentRedirect(url % kwargs)
     37        return HttpResponsePermanentRedirect(iri_to_uri(url % kwargs))
    3738    else:
    3839        return HttpResponseGone()
Back to Top