Commit 516976dc authored by Sebastien Robin's avatar Sebastien Robin

added validator patch for StringBaseValidator


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@535 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 8517cdc0
...@@ -65,6 +65,7 @@ from Products.Formulator.Validator import SelectionValidator ...@@ -65,6 +65,7 @@ from Products.Formulator.Validator import SelectionValidator
from Products.Formulator.Validator import StringBaseValidator from Products.Formulator.Validator import StringBaseValidator
def SelectionValidator_validate(self, field, key, REQUEST): def SelectionValidator_validate(self, field, key, REQUEST):
LOG('SelectionValidate_validate',0,'field; %s, key: %s')
value = StringBaseValidator.validate(self, field, key, REQUEST) value = StringBaseValidator.validate(self, field, key, REQUEST)
if value == "" and not field.get_value('required'): if value == "" and not field.get_value('required'):
...@@ -230,3 +231,14 @@ def SingleItemsWidget_render_items(self, field, key, value, REQUEST): ...@@ -230,3 +231,14 @@ def SingleItemsWidget_render_items(self, field, key, value, REQUEST):
return rendered_items return rendered_items
SingleItemsWidget.render_items = SingleItemsWidget_render_items SingleItemsWidget.render_items = SingleItemsWidget_render_items
def StringBaseValidator_validate(self, field, key, REQUEST):
# We had to add this patch for hidden fields of type "list"
value = REQUEST.get(key, "")
if type(value) is type('a'):
value = string.strip(value)
if field.get_value('required') and value == "":
self.raise_error('required_not_found', field)
return value
StringBaseValidator.validate = StringBaseValidator_validate
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment