Login
Back to bricks list
Introduction Version

StrValidator

Validator class

This validator allows validating serialized (or deserialized) string parameter values.

Usage: * Let validator = StrValidator() then * validator.validate('foo') -> 'foo' * validator.validate('false') -> 'false' * validator.validate(5) -> ValueError * validator.validate(True) -> ValueError

Functions

__INIT__

Initialize self. See help(type(self)) for accurate signature.

Parameters:
NameTypeDefault valueDescription
allowed_valuesList
min_lengthint
max_lengthint
SET_TYPE
Parameters:
NameTypeDefault valueDescription
type_Union
VALIDATE

Valitates a value.

Parameters:
NameTypeDefault valueDescription
valueUnion The value to validate an instance of `bool`, `int`, `float`, `str` or serilaizable `list`, `dict`
Return type:
Any