This shouldn't have took that much to solve. Really sorry for the delay
This commit is contained in:
niphlod
2015-12-30 16:38:43 +01:00
parent 1ca0c9b0c0
commit d4ffcaf1b1
2 changed files with 10 additions and 4 deletions
+7 -4
View File
@@ -201,12 +201,15 @@ class IS_MATCH(Validator):
def __call__(self, value):
if self.is_unicode:
if isinstance(value,unicode):
match = self.regex.search(value)
else:
if not isinstance(value, unicode):
match = self.regex.search(str(value).decode('utf8'))
else:
match = self.regex.search(value)
else:
match = self.regex.search(str(value))
if not isinstance(value, unicode):
match = self.regex.search(str(value))
else:
match = self.regex.search(value.encode('utf8'))
if match is not None:
return (self.extract and match.group() or value, None)
return (value, translate(self.error_message))