RestrictedPython
RestrictedPython copied to clipboard
How to allow a package completely?
BUG/PROBLEM REPORT / FEATURE REQUEST
What I did:
Added package to safe_globals:
import dateutil
safe_globals = {
# Others
"dateutil": dateutil
}
Code
dateutil.parser.parse("2024-01-01").strftime("%d/%m/%Y")
What I expect to happen:
Result: "01/01/2024"
What actually happened:
Error: '__import__'
This code code works:
dateutil.parser.parse("2024-01-01").date()
If the method has any import, it is not allowed