From fbb5a8b9bb8422449cbd55e7a3ea74505828b90c Mon Sep 17 00:00:00 2001 From: mdipierro Date: Thu, 25 Jun 2015 04:36:16 -0500 Subject: [PATCH] fixed issue #968, IS_MATCH validator bug with unicode, thanks alex0834 --- gluon/validators.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/gluon/validators.py b/gluon/validators.py index 5142d600..2afeedc4 100644 --- a/gluon/validators.py +++ b/gluon/validators.py @@ -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: