OpenQuizz
Une application de gestion des contenus pédagogiques
|
Public Member Functions | |
def | __init__ (self, *types.Validator validators, typing.Optional[str] error=None) |
typing.Any | __call__ (self, typing.Any value) |
![]() | |
str | __repr__ (self) |
Data Fields | |
validators | |
error | |
Static Public Attributes | |
default_error_message | |
![]() | |
error | |
Compose multiple validators and combine their error messages. Example: :: from marshmallow import validate, ValidationError def is_even(value): if value % 2 != 0: raise ValidationError("Not an even value.") validator = validate.And(validate.Range(min=0), is_even) validator(-1) # ValidationError: ['Must be greater than or equal to 0.', 'Not an even value.'] :param validators: Validators to combine. :param error: Error message to use when a validator returns ``False``.
def __init__ | ( | self, | |
*types.Validator | validators, | ||
typing.Optional[str] | error = None |
||
) |
typing.Any __call__ | ( | self, | |
typing.Any | value | ||
) |
Reimplemented from Validator.
|
static |
error |
validators |