Skip to content

Commit

Permalink
we can monkey-patch value stripping
Browse files Browse the repository at this point in the history
  • Loading branch information
tdesvenain committed Jun 3, 2014
1 parent 0b612d2 commit e1baf77
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/z3c/form/converter.py
Expand Up @@ -31,6 +31,8 @@
@zope.interface.implementer(interfaces.IDataConverter)
class BaseDataConverter(object):
"""A base implementation of the data converter."""

_strip_value = True # Remove spaces at start and end of text line

def __init__(self, field, widget):
self.field = field
Expand All @@ -44,7 +46,7 @@ def toWidgetValue(self, value):

def toFieldValue(self, value):
"""See interfaces.IDataConverter"""
if isinstance(value, basestring):
if self._strip_value and isinstance(value, basestring):
value = value.strip()
if value == u'':
return self.field.missing_value
Expand Down

0 comments on commit e1baf77

Please sign in to comment.