Giter Club home page Giter Club logo

Comments (7)

amandaschloss avatar amandaschloss commented on August 15, 2024

Have you tried using @string_rule_variable() instead of @string_rule_variable? And same for the rest of the variable decorators.

from business-rules.

lorddaren avatar lorddaren commented on August 15, 2024

New error:

Traceback (most recent call last):
  File "ksl.py", line 225, in <module>
    stop_on_first_trigger=False)
  File "/usr/local/Cellar/python3/3.4.1/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/business_rules-0.1.3-py3.4.egg/business_rules/engine.py", line 10, in run_all
  File "/usr/local/Cellar/python3/3.4.1/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/business_rules-0.1.3-py3.4.egg/business_rules/engine.py", line 19, in run
  File "/usr/local/Cellar/python3/3.4.1/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/business_rules-0.1.3-py3.4.egg/business_rules/engine.py", line 31, in check_conditions_recursively
  File "/usr/local/Cellar/python3/3.4.1/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/business_rules-0.1.3-py3.4.egg/business_rules/engine.py", line 46, in check_conditions_recursively
  File "/usr/local/Cellar/python3/3.4.1/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/business_rules-0.1.3-py3.4.egg/business_rules/engine.py", line 54, in check_condition
  File "/usr/local/Cellar/python3/3.4.1/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/business_rules-0.1.3-py3.4.egg/business_rules/engine.py", line 68, in _get_variable_value
  File "/usr/local/Cellar/python3/3.4.1/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/business_rules-0.1.3-py3.4.egg/business_rules/variables.py", line 67, in memf
TypeError: mileage() missing 1 required positional argument: 'self'

from business-rules.

amandaschloss avatar amandaschloss commented on August 15, 2024

Hmm. This is after fixing @numeric_rule_variable to @numeric_rule_variable()?

from business-rules.

lorddaren avatar lorddaren commented on August 15, 2024

Correct.

from business-rules.

amandaschloss avatar amandaschloss commented on August 15, 2024

Could you post an example of how you're actually calling engine.run?

from business-rules.

lorddaren avatar lorddaren commented on August 15, 2024

Here ya go:

    rules = """[{"actions":
                    [
                        {"fields": [],
                         "name": "ready_for_review"
                         }
                    ],
                 "conditions":
                    {"all":
                        [
                            {"operator": "less_than",
                             "value": "100000",
                              "name": "mileage"
                            },
                            {"operator": "greater_than",
                             "value": "2000",
                              "name": "year"
                             }
                        ]
                    }
                }
            ]
            """

    for car in k.postings:
        logging.debug('Running business rules on %s' % car )
        run_all(json.loads(rules),
                CarVariables,
                CarActions,
                stop_on_first_trigger=False)

from business-rules.

lorddaren avatar lorddaren commented on August 15, 2024

After posting the last output I realized my mistake. I was failing to actually pass the "car" object to the variables and actions.

from business-rules.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.