filters if len filterConditions binding_callback None for filter in fi

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
filters = ()
if len(filterConditions):
binding_callback = None
for filter in filterConditons:
binding = filter['binding']
operator = filter['op']
field = getattr(TChartAttributes, filter['fieldId'].lower(), None)
value = filter['value']
if op == '=':
f = (field == value, )
elif op == '<>':
f = (field != value, )
if binding_callback is None:
filters += f
else:
filters += (binding_callback(f), )
if binding = 'and':
binding_callback = and_
else:
binding_callback = or_