Commit 3d82bde8 authored by Romain Courteaud's avatar Romain Courteaud

Restore usage of whitespace_preserve attribute, in order to disable strip call

if not wanted.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@24793 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 518deb22
......@@ -450,6 +450,11 @@ def StringBaseValidator_validate(self, field, key, REQUEST):
else:
raise KeyError, 'Field %s is not present in request object.' % (repr(field.id), )
if isinstance(value, str):
if field.has_value('whitespace_preserve'):
if not field.get_value('whitespace_preserve'):
value = string.strip(value)
else:
# XXX Compatibility: use to prevent KeyError exception from get_value
value = string.strip(value)
if field.get_value('required') and value == "":
self.raise_error('required_not_found', field)
......
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