Why is my SimpleFieldValidator not working?

I have a dexterity content type with a date field and I have a validator for determining if the date field ends on a specific day of the week. However, it doesn't fire.

I have my code setup like this:

from z3c.form import validator
from zope.component import provideAdapter

class MyTypeValidator(validator.SimpleFieldValidator)
    def validate(self,value):
        print "is this validating?"
        #validation code

validator.WidgetValidatorDiscriminators(MyTypeValidator, field=IMyType['end_of_week'])

The print statement doesn't occur. Am I going about registering a validator the wrong way?
What's odd is that I thought I had this working before.

I'm using Plone 4.3

Have you looked at https://docs.plone.org/4/en/old-reference-manuals/forms/using_formlib/validation.html?highlight=validator ?

Thanks. I found that I was defining something wrong.

1 Like