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")
source
share