I am converting my application to use NDB. I used to have something like this:
@db.ComputedProperty def someComputedProperty(self, indexed=False): if not self.someCondition: return [] src = self.someReferenceProperty list = src.list1 + src.list2 + src.list3 + src.list4 \ + [src.str1, src.str2] return map(lambda x:'' if not x else x.lower(), list)
As you can see, my list generation method is a bit more complicated, I prefer to keep it that way. But when I started converting to NDB, I just replaced @db.ComputedProperty with @model.ComputedProperty , but then got this error:
NotImplementedError: Property someComputedProperty does not support <type 'list'> types.
I could see in model.py in ext.ndb that ComputedProperty inherits from GenericProperty , where in _db_set_value there are several if / else statements that process the value according to its type, except that there is no processing for lists
Currently, it passes the first condition and throws this error when I return an empty list.
Is there any way around this and avoiding the error?
source share