Merge pull request #1604 from ilvalle/fix_1570

prevent is_empty from stripping whitespaces, close #1570
This commit is contained in:
mdipierro
2017-04-28 08:07:20 -05:00
committed by GitHub
2 changed files with 9 additions and 8 deletions
+3 -2
View File
@@ -989,14 +989,15 @@ class IS_DECIMAL_IN_RANGE(Validator):
def is_empty(value, empty_regex=None):
_value = value
"""test empty field"""
if isinstance(value, (str, unicodeT)):
value = value.strip()
if empty_regex is not None and empty_regex.match(value):
value = ''
if value is None or value == '' or value == []:
return (value, True)
return (value, False)
return (_value, True)
return (_value, False)
class IS_NOT_EMPTY(Validator):