def __setitem__(self, k, v): # Serialize value being set super(JsonDict, self).__setitem__(k, serializeValue(v)) # You can't use __setitem__ on a @property (ie. "e.data['foo'] = 1" # will return e._data as an object which then gets updated, but those # updates won't make their way back to the db). As such, we must # update the db field hiding behind the property manually. self._apply_to_field(dict(self))
def serializeValue(value): """ Convenience method to provide interface to serializeValue tooling """ return serializeValue(value)