I want to nest my custom validators within my schema, like this:
MySchema(Schema):
class MyValidator(validators.FancyValidator):
def _to_python(self, value, state):
...
class MyOtherValidator(validators.FancyValidator):
def _to_python(self, value, state):
...
field_foo = All(validators.NotEmpty(),
MyValidator())
field_bar = All(validators.NotEmpty(),
MyOtherValidator())
However, it seems to think that MyValidator
and MyOtherValidator
are fields b/c it's form_errors
contain:
{
'MyValidator': 'Missing value',
'MyOtherValidator': 'Missing value'
}
If I don't nest them, they seem fine. What am I missing?