kopia lustrzana https://github.com/dgtlmoon/changedetection.io
Re #265 - wasnt catching the jsonpath exception due to invalid jsonpath expressions properly
rodzic
3195ffa1c6
commit
56d1dde7c3
|
@ -178,14 +178,14 @@ class ValidateCSSJSONInput(object):
|
||||||
|
|
||||||
def __call__(self, form, field):
|
def __call__(self, form, field):
|
||||||
if 'json:' in field.data:
|
if 'json:' in field.data:
|
||||||
from jsonpath_ng.exceptions import JsonPathParserError
|
from jsonpath_ng.exceptions import JsonPathParserError, JsonPathLexerError
|
||||||
from jsonpath_ng import jsonpath, parse
|
from jsonpath_ng import jsonpath, parse
|
||||||
|
|
||||||
input = field.data.replace('json:', '')
|
input = field.data.replace('json:', '')
|
||||||
|
|
||||||
try:
|
try:
|
||||||
parse(input)
|
parse(input)
|
||||||
except JsonPathParserError as e:
|
except (JsonPathParserError, JsonPathLexerError) as e:
|
||||||
message = field.gettext('\'%s\' is not a valid JSONPath expression. (%s)')
|
message = field.gettext('\'%s\' is not a valid JSONPath expression. (%s)')
|
||||||
raise ValidationError(message % (input, str(e)))
|
raise ValidationError(message % (input, str(e)))
|
||||||
|
|
||||||
|
|
Ładowanie…
Reference in New Issue