gws.base.model.validator

Base model validator.

Source code: gws.base.model.validator

Module Contents

class gws.base.model.validator.Config(*args, **kwargs)

Bases: gws.Config

Configuration for the model validator.

forCreate: bool = True

The validator is applied when creating a new object.

forUpdate: bool = True

The validator is applied when updating an existing object.

message: str = ''

Validation error message.

gws.base.model.validator.DEFAULT_MESSAGE_PREFIX = 'validationError_'
class gws.base.model.validator.Object

Bases: gws.ModelValidator

Base model validator.

Provides the error message and the set of operations the validator applies to. Subclasses implement validate.

configure()

Configuration hook.

Called when the node is initialized. Raising an exception here aborts the creation of the node.