Skip to content

Commit 6f50604

Browse files
committed
Add notes to docstrings about 'text' vs. 'bytes' semantics.
Addresses #233.
1 parent 8db9b30 commit 6f50604

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

gcloud/datastore/_helpers.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,11 @@ def _get_protobuf_attribute_and_value(val):
2929
`gcloud.datastore.key.Key` into a Protobuf representation.
3030
This function handles that for you.
3131
32+
.. note::
33+
Values which are "text" ('unicode' in Python2, 'str' in Python3) map
34+
to 'string_value' in the datastore; values which are "bytes"
35+
('str' in Python2, 'bytes' in Python3) map to 'blob_value'.
36+
3237
For example:
3338
3439
>>> _get_protobuf_attribute_and_value(1234)

gcloud/datastore/entity.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,11 @@ def save(self):
206206
not correspond to keys set on this instance will be removed from
207207
the datastore.
208208
209+
.. note::
210+
Property values which are "text" ('unicode' in Python2, 'str' in
211+
Python3) map to 'string_value' in the datastore; values which are
212+
"bytes" ('str' in Python2, 'bytes' in Python3) map to 'blob_value'.
213+
209214
:rtype: :class:`gcloud.datastore.entity.Entity`
210215
:returns: The entity with a possibly updated Key.
211216
"""

0 commit comments

Comments
 (0)