nemonik / Intellect

DSL and Rules Engine For Python
http://pypi.python.org/pypi/Intellect
Other
425 stars 85 forks source link

Allow rules to return a value #6

Closed clintonb closed 12 years ago

clintonb commented 12 years ago

It would be nice if rules could return an output value for use after reasoning. My own use case is for rules-based permissions. I would like to reason against a rule and an object, and return either True or False, depending on a user's ability to access the object.

nemonik commented 12 years ago

In the then condition you could

a) learn an object b) set a value on matching object and check the value on the object later as you hold a reference to all ear end objects c) call a callable on your intellect d) ...

clintonb commented 12 years ago

Calling a callable should work. Thanks!

nemonik commented 12 years ago

The read me has notes on how to decorate a method on your own subclass of Intellect, and I think the examples have an example of. At the very least Intellect's own log method is decorated as callable. So, use that as an example if you haven't already figured this out.

Also, I would very much like to hear what you are using Intellect for.