Skip to content
Snippets Groups Projects
Commit 35fc9460 authored by Jan Čermák's avatar Jan Čermák
Browse files

regexp validator propagates into JS

parent 6b207d19
Branches
Tags
No related merge requests found
......@@ -49,6 +49,8 @@ class RegExp(Validator):
def __init__(self, msg, reg_exp):
self.reg_exp = re.compile(reg_exp)
super(RegExp, self).__init__(msg, lambda val: bool(self.reg_exp.match(val)))
self.js_validator = ("regexp", reg_exp)
self.extra_data['parsley-error-message'] = msg
def valid(self, value):
return bool(self.reg_exp.match(value))
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment