misc: don't encode json data in py3 (#36515)
This commit is contained in:
parent
db6fe5f504
commit
5da68239d3
|
@ -244,7 +244,7 @@ def site_encode(s):
|
|||
return None
|
||||
if isinstance(s, str):
|
||||
return s
|
||||
if not isinstance(s, unicode):
|
||||
if not isinstance(s, six.string_types):
|
||||
s = force_text(s)
|
||||
return s.encode(get_publisher().site_charset)
|
||||
|
||||
|
@ -516,6 +516,8 @@ def json_encode_helper(d, charset):
|
|||
return d
|
||||
|
||||
def json_loads(value, charset=None):
|
||||
if six.PY3:
|
||||
return json.loads(value)
|
||||
charset = (get_publisher() and get_publisher().site_charset) or 'utf-8'
|
||||
return json_encode_helper(json.loads(value), charset)
|
||||
|
||||
|
|
Loading…
Reference in New Issue