Refs #23919 -- Updated references to urllib.quote() to Python 3 location.

This commit is contained in:
Ville Skyttä 2017-10-31 18:05:54 +02:00 committed by Tim Graham
parent 5e1a356060
commit 23e551ce6c
2 changed files with 5 additions and 7 deletions

View File

@ -64,8 +64,8 @@ def quote(s):
""" """
Ensure that primary key values do not confuse the admin URLs by escaping Ensure that primary key values do not confuse the admin URLs by escaping
any '/', '_' and ':' and similarly problematic characters. any '/', '_' and ':' and similarly problematic characters.
Similar to urllib.quote, except that the quoting is slightly different so Similar to urllib.parse.quote(), except that the quoting is slightly
that it doesn't get automatically unquoted by the Web browser. different so that it doesn't get automatically unquoted by the Web browser.
""" """
if not isinstance(s, str): if not isinstance(s, str):
return s return s
@ -78,9 +78,7 @@ def quote(s):
def unquote(s): def unquote(s):
""" """Undo the effects of quote(). Based heavily on urllib.parse.unquote()."""
Undo the effects of quote(). Based heavily on urllib.unquote().
"""
mychr = chr mychr = chr
myatoi = int myatoi = int
list = s.split('_') list = s.split('_')

View File

@ -139,8 +139,8 @@ def iri_to_uri(iri):
# sub-delims = "!" / "$" / "&" / "'" / "(" / ")" # sub-delims = "!" / "$" / "&" / "'" / "(" / ")"
# / "*" / "+" / "," / ";" / "=" # / "*" / "+" / "," / ";" / "="
# unreserved = ALPHA / DIGIT / "-" / "." / "_" / "~" # unreserved = ALPHA / DIGIT / "-" / "." / "_" / "~"
# Of the unreserved characters, urllib.quote already considers all but # Of the unreserved characters, urllib.parse.quote() already considers all
# the ~ safe. # but the ~ safe.
# The % character is also added to the list of safe characters here, as the # The % character is also added to the list of safe characters here, as the
# end of section 3.1 of RFC 3987 specifically mentions that % must not be # end of section 3.1 of RFC 3987 specifically mentions that % must not be
# converted. # converted.