Skip to content

Support EndpointsModel with properties repeated=True #86

catogonzalez opened this Issue Jan 9, 2014 · 3 comments

3 participants


Had the problem described and solved here:

Suggest to change line 227 and next as follows:

  # Only filter for non-null values...
  if current_value is not None:
      # ...and not empty arrays in case of properties with repeated=True
      if current_value:
          self._AddFilter(prop == current_value)

Didn't see how to create a pull request: sorry if this is not the correct way to contribute this suggestion and thanks for the great library!

kdeus commented Jan 10, 2014

A couple questions on this:

First, the latest version of has a check just above the if current_value is not None (lines 231-234):

      if prop._repeated:
        if current_value != []:
          raise ValueError('No queries on repeated values are allowed.')

Wouldn't this already catch the repeated field and prevent the problem you're talking about? Are you using an older version of the library?

And also, could something like this be used change to your Contacts class/model to change the empty list to be None instead (I haven't tested this)?

        def emails(self):
                return ndb.get_multi(self.email_keys) or None
Google Cloud Platform member
dhermes commented Jan 18, 2014

I actually fixed this for a talk but it never made it in:

Also had another fix in that fork:


Sorry for getting back so late.

@kdeus is right: I had an older version of the library and the latest version fixes the issue. Also, I haven't tried your proposed solution in my Contacts model but it might work well too.

Thanks to both @kdeus and @dhermes for your feedback.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.