mirror of
https://github.com/ZwareBear/awx.git
synced 2026-04-24 08:51:48 -05:00
support > 2 sequential and, also or
* Fixed a bug in the fact search language parser where it would not loop over all the <and, or> operations. The result, we can support (a=b or a=c or a=d) also support (a=b and b=b and c=b)
This commit is contained in:
@@ -453,10 +453,14 @@ class DynamicFilterField(models.TextField):
|
||||
|
||||
class BoolBinOp(object):
|
||||
def __init__(self, t):
|
||||
self.left = t[0][0].result
|
||||
self.right = t[0][2].result
|
||||
|
||||
self.result = self.execute_logic(self.left, self.right)
|
||||
self.result = None
|
||||
i = 2
|
||||
while i < len(t[0]):
|
||||
if not self.result:
|
||||
self.result = t[0][0].result
|
||||
right = t[0][i].result
|
||||
self.result = self.execute_logic(self.result, right)
|
||||
i += 2
|
||||
|
||||
|
||||
class BoolAnd(BoolBinOp):
|
||||
@@ -508,7 +512,7 @@ class DynamicFilterField(models.TextField):
|
||||
|
||||
try:
|
||||
res = boolExpr.parseString('(' + filter_string + ')')
|
||||
except:
|
||||
except Exception:
|
||||
raise RuntimeError(u"Invalid query %s" % filter_string_raw)
|
||||
|
||||
if len(res) > 0:
|
||||
|
||||
Reference in New Issue
Block a user