Skip to content
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

Fix calculations using built-ins #580

Merged
merged 2 commits into from
Jan 18, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ Changelog

**Fixed**

- #580 Fix calculations using built-ins
- #563 Deactivated Analyses are added in new ARs when using Analysis Profiles/Template
- #562 Client Batch lists are empty
- #561 Sampler field is not displayed in Analysis Request Add form
Expand Down
10 changes: 9 additions & 1 deletion bika/lims/content/calculation.py
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,15 @@ def _getGlobals(self, **kwargs):
"""Return the globals dictionary for the formula calculation
"""
# Default globals
globs = {"__builtins__": None, 'math': math}
globs = {
"__builtins__": None,
"math": math,
"round": round,
"divmod": divmod,
"float": float,
"int": int,
"max": max,
}
# Update with keyword arguments
globs.update(kwargs)
# Update with additional Python libraries
Expand Down