Hello
Im working on a django project where i want to store a set of requirements for a course, but these requirements are not simple, they could be a combination of and / or ie,
((course1 or course2) and course3)
I found this boolean parser, and have kinda figured out how it works, the only hickup is that once it gets an operand, it uses eval() to find the value of the variable.
In my case, these values will be dynamic and need to be calculated based on certain parameters. Any ideas on implementation would be greatly helpful.
You can create your own resolver for names like this:
However, is the administrator of the site the one who configures these requirements? Using
eval()will execute any code, so it is always a potential security risk. If the requirements come from an untrusted source, then building custom parser using theastmodule would be a better solution.