32 lines
1.2 KiB
Python
32 lines
1.2 KiB
Python
def applyConditions(definition, dictionary):
|
|
if hasattr(definition, "filters"):
|
|
print("DEBUG DICTIONARY PASS")
|
|
print(dictionary)
|
|
for filter in definition.filters:
|
|
|
|
if filter["operator"] == ">=":
|
|
if dictionary.get(filter["filterkey"]) >= filter["filtervalue"]:
|
|
print(filter["print"])
|
|
return True
|
|
|
|
if filter["operator"] == "<=":
|
|
if dictionary.get(filter["filterkey"]) <= filter["filtervalue"]:
|
|
print(filter["print"])
|
|
return True
|
|
|
|
if filter["operator"] == "==":
|
|
if dictionary.get(filter["filterkey"]) == filter["filtervalue"]:
|
|
print(filter["print"])
|
|
return True
|
|
|
|
if filter["operator"] == "!=":
|
|
if dictionary.get(filter["filterkey"]) != filter["filtervalue"]:
|
|
print(filter["print"])
|
|
return True
|
|
|
|
if filter["operator"] == "in":
|
|
if filter["filtervalue"] in dictionary:
|
|
print(filter["print"])
|
|
return True
|
|
|
|
return False |