Consistently use db_to_json to convert from database values to JSON objects. (#7849)

This commit is contained in:
Patrick Cloke 2020-07-16 11:32:19 -04:00 committed by GitHub
parent b0f031f92a
commit f460da6031
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
22 changed files with 80 additions and 82 deletions

View file

@ -100,8 +100,8 @@ def db_to_json(db_content):
if isinstance(db_content, memoryview):
db_content = db_content.tobytes()
# Decode it to a Unicode string before feeding it to json.loads, so we
# consistenty get a Unicode-containing object out.
# Decode it to a Unicode string before feeding it to json.loads, since
# Python 3.5 does not support deserializing bytes.
if isinstance(db_content, (bytes, bytearray)):
db_content = db_content.decode("utf8")