Skip to content

Commit

Permalink
simplify + preserve existing behavior better (ie utf-8 works :P)
Browse files Browse the repository at this point in the history
  • Loading branch information
pnico committed Aug 21, 2023
1 parent cf447e0 commit 4e733ec
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/google/appengine/ext/ndb/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -2741,10 +2741,9 @@ def _db_get_value(self, v, p):
sval = modelclass._from_pb(pb)
elif meaning != entity_pb2.Property.BYTESTRING:
try:
if six.PY2:
sval.decode('ascii')
elif meaning == entity_pb2.Property.TEXT:
sval = sval.decode('ascii')
decoded = sval.decode('ascii')
if six.PY3 and meaning == entity_pb2.Property.TEXT:
sval = decoded
except UnicodeDecodeError:
try:
sval = six.text_type(sval.decode('utf-8'))
Expand Down

0 comments on commit 4e733ec

Please sign in to comment.