1
0
mirror of https://github.com/django/django.git synced 2025-10-24 14:16:09 +00:00

Assumed iri_to_uri always returns a string

Thanks Tim Graham for the review.
This commit is contained in:
Claude Paroz
2017-01-23 17:44:25 +01:00
parent f0573aad4b
commit d2e7d15b4c
5 changed files with 18 additions and 17 deletions

View File

@@ -733,8 +733,7 @@ in ``get_absolute_url()`` and have all your other code call that one place.
Code and templates calling ``get_absolute_url()`` should be able to use the
result directly without any further processing. You may wish to use the
``django.utils.encoding.iri_to_uri()`` function to help with this if you
are using unicode strings containing characters outside the ASCII range at
all.
are using strings containing characters outside the ASCII range.
Extra instance methods
======================

View File

@@ -262,12 +262,12 @@ The functions defined in this module share the following properties:
Convert an Internationalized Resource Identifier (IRI) portion to a URI
portion that is suitable for inclusion in a URL.
This is the algorithm from section 3.1 of :rfc:`3987#section-3.1`. However,
since we are assuming input is either UTF-8 or unicode already, we can
simplify things a little from the full method.
This is the algorithm from section 3.1 of :rfc:`3987#section-3.1`, slightly
simplified since the input is assumed to be a string rather than an
arbitrary byte stream.
Takes an IRI in UTF-8 bytes and returns ASCII bytes containing the encoded
result.
Takes an IRI (string or UTF-8 bytes) and returns a string containing the
encoded result.
.. function:: uri_to_iri(uri)