Skip to content
Browse files

Only failing on repeated properties in a query if non-empty. Fixes Is…

  • Loading branch information...
1 parent cfafea1 commit 183ab0ff336857e081148ac2fdaa73543ca44452 @dhermes dhermes committed Feb 22, 2013
Showing with 6 additions and 1 deletion.
  1. +6 −1 endpoints_proto_datastore/ndb/model.py
View
7 endpoints_proto_datastore/ndb/model.py
@@ -224,6 +224,11 @@ def _PopulateFilters(self):
attr_name = prop._code_name
current_value = getattr(entity, attr_name)
+ if prop._repeated:
+ if current_value != []:
+ raise ValueError('No queries on repeated values are allowed.')
+ continue
+
# Only filter for non-null values
if current_value is not None:
self._AddFilter(prop == current_value)
@@ -1075,7 +1080,7 @@ def ToMessage(self, fields=None):
if value is None:
continue
- if getattr(proto_model, name).repeated:
+ if field.repeated:
if not isinstance(value, (list, tuple)):
error_msg = ('Property %s is a repeated field and its value should '
'be a list or tuple. Received: %s' % (name, value))

0 comments on commit 183ab0f

Please sign in to comment.
Something went wrong with that request. Please try again.