Glad to discover that there's a group for ndb.
In our application we had sub-classed StringListProperty to insure that the
values in the list were unique simply by doing
def get_value_for_datastore(self, model_instance):
#dedupe the underlying list
lst = list(set(super(UniqueStringListProperty,
self).get_value_for_datastore(model_instance)))
#normalize it and return
return [x.strip().lower() for x in lst if x is not None \
and len(x.strip()) > 0]
So I can't figure out how to do this in ndb since _to_base_type gets a
single value out of the list at a time.
I suppose it is possible to put this behavior on the class, but we use this
a lot so I was wondering if there is any mechanism on Properties for
validation/conversion that operates on all the items at once?
Any ideas?
Thanks In Advance
Tom
--
You received this message because you are subscribed to the Google Groups
"Google App Engine" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/google-appengine/-/KVmjumS3K3EJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-appengine?hl=en.