How to check type restrictions of dexterity content types

I want to check during the process of saving the form of the form the value of the field checks some restrictions

(understand the method call in which I can invalidate the action of the form)

+5
source share
3 answers

The field must be defined through the scheme (not a supermodel), otherwise the field will not be visible in the scheme. Once a field is defined in a schema, you can use a decorating function, such as the following, to install a field validator:

@form.validator(field=IMySchema['title'])
def validateTitle(value):
    if value == value.upper():
        raise schema.ValidationError(u"Please don't shout")
+6
source

I am sure that you can do this using the file system code agility type using the zope.interface invariants .

+2
source

Dexterity , validators.

+1
source

All Articles