-
Notifications
You must be signed in to change notification settings - Fork 261
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Variable memoization seems broken on Python 3.4.1 #16
Comments
@bradmontgomery try defining your @string_rule_variable()
def submitted_day(self):
# Weekday as locale’s full name; e.g. 'Saturday'
return self.entry.submitted_on.strftime("%A") Notice the open/close parens on the decorator. This should fix the issue. |
@bradmontgomery this PR should fix that requirement: #17 |
doh! Thanks for the clarification 😅 And 👍 for #17 |
vrsandeep
pushed a commit
to vrsandeep/business-rules
that referenced
this issue
May 31, 2019
…sults CP-455: Return a list of booleans from run_all
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The function memoization seems to be broken on Python 3.4.1. I've got the
following variables and rules for a Django model called
Entry
(just assumeit's got some text and a
submitted_on
field that is adatetime
object).The variables are configured like so:
While the Actions are configured as:
I've got the following rules:
And I'm running the rules like so:
As configured above, doing this results in:
However, if I skip the memoization of the variables, by using the
rule_variable
decorator directly, things work as expected.
Meanwhile, at the point in the stack trace above,
method
appears to be:which does not have a
field_type
attribute, whileval
is:and does seem to have the
field_type
attribute, and also seems to be aninstance of a rule variable (
val.is_rule_variable
isTrue
).I'm a little at a loss as to what the intention was here, but I wanted to report
what I've found so far.
Any ideas? Am I doing something obviously wrong?
Thanks in advance!
The text was updated successfully, but these errors were encountered: