fixed issue #968, IS_MATCH validator bug with unicode, thanks alex0834

This commit is contained in:
mdipierro
2015-06-25 04:36:16 -05:00
parent df34869d65
commit fbb5a8b9bb
+5 -2
View File
@@ -200,8 +200,11 @@ class IS_MATCH(Validator):
self.is_unicode = is_unicode
def __call__(self, value):
if self.is_unicode and not isinstance(value, unicode):
match = self.regex.search(str(value).decode('utf8'))
if self.is_unicode:
if isinstance(value,unicode):
match = self.regex.search(value)
else:
match = self.regex.search(str(value).decode('utf8'))
else:
match = self.regex.search(str(value))
if match is not None: