Skip to content

Commit

Permalink
Document further how 'text' vs. 'bytes' values are stored.
Browse files Browse the repository at this point in the history
Note how the two differ in Python2 vs. Python3.

Fixes #266.
  • Loading branch information
tseaver committed Nov 3, 2014
1 parent f33e557 commit b7ec437
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions gcloud/datastore/entity.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,16 @@ class Entity(dict):
>>> dict(entity)
{'age': 20, 'name': 'JJ'}
.. note::
When saving an entity to the backend, values which are "text"
('unicode' in Python2, 'str' in Python3) will be saved using
the 'text_value' field, after being encoded to UTF-8. When
retrieved from the back-end, such values will be decoded to "text"
again. Values which are "bytes" ('str' in Python2, 'bytes' in
Python3), will be saved using the 'bytes_value' field, without
any decoding / encoding step.
"""

def __init__(self, dataset=None, kind=None):
Expand Down

0 comments on commit b7ec437

Please sign in to comment.