Skip to content

Commit

Permalink
Avoid mandating type of field names passed to 'exclude_from_indexes'.
Browse files Browse the repository at this point in the history
Incorporates feedback from @dhermes.
  • Loading branch information
tseaver committed Nov 4, 2014
1 parent 41a0412 commit 5762cbf
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
8 changes: 4 additions & 4 deletions gcloud/datastore/dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,11 @@ def entity(self, kind, exclude_from_indexes=()):
"""Create an entity bound to this dataset.
:type kind: string
:param kind: the "kind" of the new entity.
:param kind: the "kind" of the new entity (see
https://cloud.google.com/datastore/docs/concepts/entities#Datastore_Kinds_and_identifiers)
:type exclude_from_indexes: sequence of str
:param exclude_from_indexes: Names of properties *not* to be indexed
for the entity.
:param exclude_from_indexes: names of fields whose values are not to
be indexed.
:rtype: :class:`gcloud.datastore.entity.Entity`
:returns: a new Entity instance, bound to this dataset.
Expand Down
13 changes: 11 additions & 2 deletions gcloud/datastore/entity.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,15 @@ class Entity(dict):
Python3), will be saved using the 'blob_value' field, without
any decoding / encoding step.
:type dataset: :class:`gcloud.datastore.dataset.Dataset`, or None
:param dataset: the Dataset instance associated with this entity.
:type kind: str
:param kind: the "kind" of the entity (see
https://cloud.google.com/datastore/docs/concepts/entities#Datastore_Kinds_and_identifiers)
:param exclude_from_indexes: names of fields whose values are not to be
indexed for this entity.
"""

def __init__(self, dataset=None, kind=None, exclude_from_indexes=()):
Expand Down Expand Up @@ -142,9 +151,9 @@ def kind(self):
return self._key.kind()

def exclude_from_indexes(self):
"""Return field names which are *not* to be indexed.
"""Names of fields which are *not* to be indexed for this entity.
:rtype: list(str)
:rtype: sequence of field names
"""
return frozenset(self._exclude_from_indexes)

Expand Down

0 comments on commit 5762cbf

Please sign in to comment.