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

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