RestrictedPython icon indicating copy to clipboard operation
RestrictedPython copied to clipboard

How to allow a package completely?

Open wildsonc opened this issue 1 year ago • 5 comments

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

wildsonc avatar Jun 28 '24 20:06 wildsonc