Comments (7)
Have you tried using @string_rule_variable() instead of @string_rule_variable? And same for the rest of the variable decorators.
from business-rules.
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.
Hmm. This is after fixing @numeric_rule_variable to @numeric_rule_variable()?
from business-rules.
Correct.
from business-rules.
Could you post an example of how you're actually calling engine.run?
from business-rules.
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.
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)
- numeric_rule_variable issue for the attributes like "Age" HOT 1
- Defining a ruleset HOT 1
- For every business rules
- Calculate variables from an api response? HOT 1
- Variable compared to another variable HOT 2
- syntax error in example in README? HOT 3
- Setting default evaluation value for a rule variable HOT 1
- Use decorators, type hinting and docstrings to make it awesome HOT 1
- Ability to pass parameters into the Rule variables HOT 1
- Implement proper method to get core path and system path in tests
- not_equal_to operator is not working in both string and numeric types. HOT 1
- Async function in specified action
- Use both ANY and ALL conditions together in one rule
- setuptools - ValueError: Newlines are not allowed HOT 2
- Capture conditions which satisfies a rule
- How to pass parameters into variables? HOT 1
- Even the operator has no value (FIELD_NO_INPUT) the lib looks for value property and throw a key error.
- The given example is not meaningful, and the rule definition is incorrect (json payload in Github page). HOT 2
- Add "not_" operators to string_rule_variables
- Add date and time type variable HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from business-rules.