Skip to content

Commit 4e733ec

Browse files
committed
simplify + preserve existing behavior better (ie utf-8 works :P)
1 parent cf447e0 commit 4e733ec

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/google/appengine/ext/ndb/model.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2741,10 +2741,9 @@ def _db_get_value(self, v, p):
27412741
sval = modelclass._from_pb(pb)
27422742
elif meaning != entity_pb2.Property.BYTESTRING:
27432743
try:
2744-
if six.PY2:
2745-
sval.decode('ascii')
2746-
elif meaning == entity_pb2.Property.TEXT:
2747-
sval = sval.decode('ascii')
2744+
decoded = sval.decode('ascii')
2745+
if six.PY3 and meaning == entity_pb2.Property.TEXT:
2746+
sval = decoded
27482747
except UnicodeDecodeError:
27492748
try:
27502749
sval = six.text_type(sval.decode('utf-8'))

0 commit comments

Comments
 (0)