This validator does not check the field value 'required' to ensure that empty strings on non-required fields are accepted.
From the standard validators, this base case is accounted for:
value = StringValidator.validate(self, field, key, REQUEST)
if value == "" and not field.get_value('required'):
return value
The RegexValidator inherits the StringBaseValidator, so we need to change this slightly:
value = StringBaseValidator.validate(self, field, key, REQUEST)
if value == "" and not field.get_value('required'):
return value
|