New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refs #23919 -- Deprecated django.utils.http urllib equivalents #7906
Conversation
@timgraham I created that patch before the discussions about delaying deprecations for Python 2 stuff. So I can as well remove the deprecations if it is decided that way. |
e49dc77
to
1861171
Compare
One thing we are losing with removing our versions is to pass lazy URL strings to these functions. I'm not sure it's worth keeping them, as the use case is rather thin (AFAIK untested). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So far, Aymeric proposed to start the deprecations in Django 2.2 or 3.0.
@@ -318,14 +318,14 @@ def urlencode(value, safe=None): | |||
Escapes a value for use in a URL. | |||
|
|||
Takes an optional ``safe`` parameter used to determine the characters which | |||
should not be escaped by Django's ``urlquote`` method. If not provided, the | |||
should not be escaped by Python's ``quote`` method. If not provided, the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
method -> function
Also, I usually use quote() rather than "quote" with backticks.
strings. The url is first UTF-8 encoded before quoting. The returned string | ||
can safely be used as part of an argument to a subsequent iri_to_uri() call | ||
without double-quoting occurring. | ||
A legacy compatibility wrapper to Python's urllib.parse.quote() function. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You might add something like "(did something different for Python 2)" similar to django.utils._os.
@@ -686,25 +686,18 @@ escaping HTML. | |||
|
|||
.. function:: urlquote(url, safe='/') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we could remove the useless wrappers from the documentation.
Applying further encoding (such as :meth:`~django.utils.http.urlquote` or | ||
``urllib.quote``) to the output of ``reverse()`` may produce undesirable | ||
results. | ||
Applying further encoding (such as :py:func:`urllib.parse.quote`) to the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the :py
prefix isn't needed (at least, there are many more links without it than with it in Django's docs).
``iri_to_uri()`` call without double-quoting occurring. Employs lazy | ||
execution. | ||
A legacy compatibility wrapper to Python's | ||
:py:func:`urllib.parse.quote_plus()` function. | ||
|
||
.. function:: urlencode(query, doseq=0) | ||
|
||
A version of Python's urllib.urlencode() function that can operate on |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While you're here:
:func:`urllib.urlencode`
How do you envision the process. List the to-deprecate stuff in a ticket or add a special warning in the code (which may be a noop until 2.2)? |
…hon equivalents Thanks Tim Graham for the review.
Aymeric started a "Cleanups when no supported version of Django supports Python 2 anymore" ticket: #27753. I would add this deprecation there. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The first commit looks good besides the outdated doc references flagged by the build error.
A version of Python's urllib.urlencode() function that can operate on | ||
unicode strings. The parameters are first cast to UTF-8 encoded strings | ||
and then encoded as per normal. | ||
A version of Python's :func:`urllib.parse.urlencode()` function that can |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Usually the () are omitted since sphinx adds those to the rendered version.
I merged the first commit in fee42fd. |
No description provided.