to have advanced constraints and loading available in the search API, we would need to supplement the basic/listmodel with hooks to call registered validator classes at the is_valid invocation.
registration should be done by a dict("record_type_name": validator class)
Example:
The validator class init still cannot register list fields as its a listModel duty.
But the validator class could have a callback method that will be called by listModel at registration time
def init_validator(self, listmodel_validator):
pass
the is_valid method could calculate inter-field constraints or more complex constraints on field.
Depending on a validator flag value, Is_valid would be called before or after or inplace of the basicmodel is_valid.
methods = [self.is_valid, validator.is_valid]
or
methods = [validator.is_valid, self.is_valid]
[..]
for m in methods:
ret = m()
if not ret:
return False
return True
No load_members override.
listmodel should be modified directly. usage of the list methods are just complex without this.
to have advanced constraints and loading available in the search API, we would need to supplement the basic/listmodel with hooks to call registered validator classes at the is_valid invocation. registration should be done by a dict("record_type_name": validator class)
Example: The validator class init still cannot register list fields as its a listModel duty. But the validator class could have a callback method that will be called by listModel at registration time def init_validator(self, listmodel_validator): pass
the is_valid method could calculate inter-field constraints or more complex constraints on field. Depending on a validator flag value, Is_valid would be called before or after or inplace of the basicmodel is_valid. methods = [self.is_valid, validator.is_valid] or methods = [validator.is_valid, self.is_valid] [..] for m in methods: ret = m() if not ret: return False return True
No load_members override.
listmodel should be modified directly. usage of the list methods are just complex without this.