gws.plugin.model_validator.not_empty¶
Validator for non-empty values.
Fails if the field value is None or a string that is empty or consists only of
whitespace. Fields with isAuto always pass when a feature is created,
since their value is set by the database.
Every field runs a default instance of this validator; a failure is reported
only if the field is required (isRequired). A configured notEmpty
validator replaces the default one, e.g. to set a custom message.
Example:
fields+ {
name "name"
type "text"
isRequired true
validators+ { type "notEmpty" message "Name is required" }
}
Source code: gws.plugin.model_validator.not_empty
Package Contents¶
- class gws.plugin.model_validator.not_empty.Config¶
Bases:
gws.base.model.validator.ConfigChecks that a value is not empty.
- class gws.plugin.model_validator.not_empty.Object¶
Bases:
gws.base.model.validator.ObjectNot-empty validator object.
- validate(field, feature, mc)¶