0
for product in Product_info:
    run_all(rule_list=rule,
            defined_variables=ProductVariables(product),
            defined_actions=ProductActions(product),
            stop_on_first_trigger=True
            )

How run_all() function is working???

I am Expecting pip install business-rules with this library. Present we are using this library.

  1. Give me example of "Define Your set of variables"
@string_rule_variable()
class ProductVariables(BaseVariables):

    def __init__(self, name, loc):
        self.name = name
        self.loc = loc
  1. example of "Define your set of actions"
@rule_action(params={"sale_percentage": FIELD_NUMERIC})

3.What is run your rule??????

from business_rules import run_all

rules = _some_function_to_receive_from_client()

for product in Products.objects.all():
    run_all(rule_list=rules,
            defined_variables=ProductVariables(product),
            defined_actions=ProductActions(product),
            stop_on_first_trigger=True
           )

0 Answers0