mirror of
https://github.com/ansible/awx.git
synced 2026-03-23 11:55:04 -02:30
fix: catch correct exception when parsing filter (#15458)
This commit is contained in:
@@ -1,5 +1,7 @@
|
|||||||
import re
|
import re
|
||||||
from functools import reduce
|
from functools import reduce
|
||||||
|
|
||||||
|
from django.core.exceptions import FieldDoesNotExist
|
||||||
from pyparsing import (
|
from pyparsing import (
|
||||||
infixNotation,
|
infixNotation,
|
||||||
opAssoc,
|
opAssoc,
|
||||||
@@ -353,7 +355,7 @@ class SmartFilter(object):
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
res = boolExpr.parseString('(' + filter_string + ')')
|
res = boolExpr.parseString('(' + filter_string + ')')
|
||||||
except ParseException:
|
except (ParseException, FieldDoesNotExist):
|
||||||
raise RuntimeError(u"Invalid query %s" % filter_string_raw)
|
raise RuntimeError(u"Invalid query %s" % filter_string_raw)
|
||||||
|
|
||||||
if len(res) > 0:
|
if len(res) > 0:
|
||||||
|
|||||||
Reference in New Issue
Block a user