I've written a custom validator for my schema field as shown in the documentation here: http://docs.plone.org/develop/plone/forms/z3c.form.html#form-widget-validators
My question is that if i want to use the same validator for a few different fields, is that possible? It doesnt seem to work. eg I would like to write:
# Set conditions for which fields the validator class applies
validator.WidgetValidatorDiscriminators(PhoneNumberValidator, field=IZohoContactForm['phone_number'])
validator.WidgetValidatorDiscriminators(PhoneNumberValidator, field=IZohoContactForm['another_phone_field'])
As a workaround I have written two identical validators with different names which violates the DRY principle but not much i can for this one it seems...