Skip to content

Commit

Permalink
[1.3.X] Fixed #15593 -- Added a note that the output of reverse is …
Browse files Browse the repository at this point in the history
…urlquoted. Thanks to guettli for the report and draft patch.

Backport of [16054] from trunk.


git-svn-id: http://code.djangoproject.com/svn/django/branches/releases/1.3.X@16055 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information
Gabriel Hurley committed Apr 20, 2011
1 parent b061cb9 commit 24adaf7
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
2 changes: 2 additions & 0 deletions docs/ref/unicode.txt
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,8 @@ Normally, you'll only need to use ``smart_unicode()``. Call it as early as
possible on any input data that might be either Unicode or a bytestring, and
from then on, you can treat the result as always being Unicode.

.. _uri-and-iri-handling:

URI and IRI handling
~~~~~~~~~~~~~~~~~~~~

Expand Down
16 changes: 14 additions & 2 deletions docs/topics/http/urls.txt
Original file line number Diff line number Diff line change
Expand Up @@ -772,9 +772,9 @@ reverse()

If you need to use something similar to the :ttag:`url` template tag in
your code, Django provides the following method (in the
``django.core.urlresolvers`` module):
:mod:`django.core.urlresolvers` module):

.. function:: reverse(viewname, urlconf=None, args=None, kwargs=None, current_app=None)
.. function:: reverse(viewname, [urlconf=None, args=None, kwargs=None, current_app=None])

``viewname`` is either the function name (either a function reference, or the
string version of the name, if you used that form in ``urlpatterns``) or the
Expand Down Expand Up @@ -815,6 +815,18 @@ namespaces into URLs on specific application instances, according to the
be imported correctly. Do not include lines that reference views you
haven't written yet, because those views will not be importable.

.. note::

The string returned by :meth:`~django.core.urlresolvers.reverse` is already
:ref:`urlquoted <uri-and-iri-handling>`. For example::

>>> reverse('cities', args=u'Orléans')
'.../Orl%C3%A9ans/'

Applying further encoding (such as :meth:`~django.utils.http.urlquote` or
``urllib.quote``) to the ouput of :meth:`~django.core.urlresolvers.reverse`
may produce undesirable results.

resolve()
---------

Expand Down

0 comments on commit 24adaf7

Please sign in to comment.