Classes
ValidationResult
4
▼
The outcome of validating form data against a set of rules.
``is_valid`` is True when there are no…
ValidationResult
4
▼
The outcome of validating form data against a set of rules.
is_validis True when there are no errors.
The result is falsy when invalid, so you can write::
result = validate(form, rules)
if not result:
return Template("form.html", form=form, errors=result.errors)
datacontains the cleaned string values for all validated fields
(only populated when there are no errors).
errorsmaps field names to lists of error messages::
{"title": ["This field is required"],
"email": ["Must be a valid email address"]}
Attributes
| Name | Type | Description |
|---|---|---|
data |
dict[str, str]
|
— |
errors |
dict[str, list[str]]
|
— |
Methods
is_valid
0
bool
▼
True if validation passed with no errors.
property
is_valid
0
bool
▼
def is_valid(self) -> bool
Returns
bool
Internal Methods 1 ▼
__bool__
0
bool
▼
Falsy when invalid — enables ``if not result:`` pattern.
__bool__
0
bool
▼
def __bool__(self) -> bool
Returns
bool