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
Closed
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,14 @@ | ||
import hashlib | ||
from urllib.parse import quote | ||
|
||
from django.utils.encoding import force_bytes | ||
from django.utils.http import urlquote | ||
|
||
TEMPLATE_FRAGMENT_KEY_TEMPLATE = 'template.cache.%s.%s' | ||
|
||
|
||
def make_template_fragment_key(fragment_name, vary_on=None): | ||
if vary_on is None: | ||
vary_on = () | ||
key = ':'.join(urlquote(var) for var in vary_on) | ||
key = ':'.join(quote(str(var)) for var in vary_on) | ||
args = hashlib.md5(force_bytes(key)) | ||
return TEMPLATE_FRAGMENT_KEY_TEMPLATE % (fragment_name, args.hexdigest()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -684,27 +684,10 @@ escaping HTML. | |
.. module:: django.utils.http | ||
:synopsis: HTTP helper functions. (URL encoding, cookie handling, ...) | ||
|
||
.. function:: urlquote(url, safe='/') | ||
|
||
A version of Python's ``urllib.quote()`` function that can operate on | ||
unicode 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. Employs lazy | ||
execution. | ||
|
||
.. function:: urlquote_plus(url, safe='') | ||
|
||
A version of Python's urllib.quote_plus() function that can operate on | ||
unicode 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. Employs lazy | ||
execution. | ||
|
||
.. function:: urlencode(query, doseq=0) | ||
|
||
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 commentThe reason will be displayed to describe this comment to others. Learn more. Usually the () are omitted since sphinx adds those to the rendered version. |
||
operate on ``MultiValueDict`` and non-string values. | ||
|
||
.. function:: cookie_date(epoch_seconds=None) | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.