Revert back to more explicit ParseException

This commit is contained in:
Wayne Witzel III
2017-05-19 16:13:50 -04:00
parent bac1e8b4fe
commit b99a118aae
2 changed files with 3 additions and 1 deletions

View File

@@ -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),

View File

@@ -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: