##// END OF EJS Templates
validators: added json validator.
marcink -
r2400:539f2965 default
parent child Browse files
Show More
@@ -28,6 +28,7 b' import colander'
28
28
29 from rhodecode.translation import _
29 from rhodecode.translation import _
30 from rhodecode.lib.utils2 import glob2re, safe_unicode
30 from rhodecode.lib.utils2 import glob2re, safe_unicode
31 from rhodecode.lib.ext_json import json
31
32
32 log = logging.getLogger(__name__)
33 log = logging.getLogger(__name__)
33
34
@@ -138,3 +139,11 b' class CloneUriValidator(object):'
138 msg = _(u'invalid clone url for {repo_type} repository').format(
139 msg = _(u'invalid clone url for {repo_type} repository').format(
139 repo_type=self.repo_type)
140 repo_type=self.repo_type)
140 raise colander.Invalid(node, msg)
141 raise colander.Invalid(node, msg)
142
143
144 def json_validator(node, value):
145 try:
146 json.loads(value)
147 except (Exception,):
148 msg = _(u'Please enter a valid json object')
149 raise colander.Invalid(node, msg)
General Comments 0
You need to be logged in to leave comments. Login now