mirror of
https://github.com/ansible/awx.git
synced 2026-03-26 21:35:01 -02:30
Revert back to more explicit ParseException
This commit is contained in:
@@ -129,6 +129,7 @@ class TestSmartFilterQueryFromString():
|
|||||||
q = SmartFilter.query_from_string(filter_string)
|
q = SmartFilter.query_from_string(filter_string)
|
||||||
assert unicode(q) == unicode(q_expected)
|
assert unicode(q) == unicode(q_expected)
|
||||||
|
|
||||||
|
|
||||||
'''
|
'''
|
||||||
#('"facts__quoted_val"="f\"oo"', 1),
|
#('"facts__quoted_val"="f\"oo"', 1),
|
||||||
#('facts__facts__arr[]="foo"', 1),
|
#('facts__facts__arr[]="foo"', 1),
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ from pyparsing import (
|
|||||||
Optional,
|
Optional,
|
||||||
Literal,
|
Literal,
|
||||||
CharsNotIn,
|
CharsNotIn,
|
||||||
|
ParseException,
|
||||||
)
|
)
|
||||||
|
|
||||||
import django
|
import django
|
||||||
@@ -235,7 +236,7 @@ class SmartFilter(object):
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
res = boolExpr.parseString('(' + filter_string + ')')
|
res = boolExpr.parseString('(' + filter_string + ')')
|
||||||
except Exception:
|
except ParseException:
|
||||||
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