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