Kaydet (Commit) a4de60a1 authored tarafından Jeremy Hylton's avatar Jeremy Hylton

Whitespace normalization.

üst 663fffa4
...@@ -504,7 +504,7 @@ def quote_from_bytes(bs, safe='/'): ...@@ -504,7 +504,7 @@ def quote_from_bytes(bs, safe='/'):
_safe_quoters[cachekey] = quoter _safe_quoters[cachekey] = quoter
return ''.join(map(quoter.__getitem__, bs)) return ''.join(map(quoter.__getitem__, bs))
def urlencode(query,doseq=0): def urlencode(query, doseq=0):
"""Encode a sequence of two-element tuples or dictionary into a URL query string. """Encode a sequence of two-element tuples or dictionary into a URL query string.
If any values in the query arg are sequences and doseq is true, each If any values in the query arg are sequences and doseq is true, each
...@@ -515,7 +515,7 @@ def urlencode(query,doseq=0): ...@@ -515,7 +515,7 @@ def urlencode(query,doseq=0):
input. input.
""" """
if hasattr(query,"items"): if hasattr(query, "items"):
# mapping objects # mapping objects
query = query.items() query = query.items()
else: else:
...@@ -531,8 +531,9 @@ def urlencode(query,doseq=0): ...@@ -531,8 +531,9 @@ def urlencode(query,doseq=0):
# allowed empty dicts that type of behavior probably should be # allowed empty dicts that type of behavior probably should be
# preserved for consistency # preserved for consistency
except TypeError: except TypeError:
ty,va,tb = sys.exc_info() ty, va, tb = sys.exc_info()
raise TypeError("not a valid non-string sequence or mapping object").with_traceback(tb) raise TypeError("not a valid non-string sequence "
"or mapping object").with_traceback(tb)
l = [] l = []
if not doseq: if not doseq:
...@@ -551,7 +552,7 @@ def urlencode(query,doseq=0): ...@@ -551,7 +552,7 @@ def urlencode(query,doseq=0):
# is there a reasonable way to convert to ASCII? # is there a reasonable way to convert to ASCII?
# encode generates a string, but "replace" or "ignore" # encode generates a string, but "replace" or "ignore"
# lose information and "strict" can raise UnicodeError # lose information and "strict" can raise UnicodeError
v = quote_plus(v.encode("ASCII","replace")) v = quote_plus(v.encode("ASCII", "replace"))
l.append(k + '=' + v) l.append(k + '=' + v)
else: else:
try: try:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment