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,7 +450,12 @@ def StringBaseValidator_validate(self, field, key, REQUEST): ...@@ -450,7 +450,12 @@ def StringBaseValidator_validate(self, field, key, REQUEST):
else: else:
raise KeyError, 'Field %s is not present in request object.' % (repr(field.id), ) raise KeyError, 'Field %s is not present in request object.' % (repr(field.id), )
if isinstance(value, str): if isinstance(value, str):
value = string.strip(value) 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 == "": if field.get_value('required') and value == "":
self.raise_error('required_not_found', field) self.raise_error('required_not_found', field)
#if field.get_value('uppercase'): #if field.get_value('uppercase'):
......
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