Přejít na obsah
Menu
You need to be registered to interact with the community.
This question has been flagged
2 Odpovědi
3022 Zobrazení

Hey

I am trying to implement safe_eval to calculate some formulas but when I try to "import math" it gives me an error  


safe_eval('aoc = math.pi * (radius**2)',{'radius': 3},mode='exec',nocopy= True)
Any suggestions would be greatly appreciated

Thanks


Avatar
Zrušit
Autor Nejlepší odpověď

I  blacklisted the import function somewhere in tools.py and now I can import math function

Avatar
Zrušit
Nejlepší odpověď

Hi,
Can you try importing the library “from odoo.tools.safe_eval import safe_eval” instead of using math library and then use the function safe_eval

Avatar
Zrušit
Related Posts Odpovědi Zobrazení Aktivita
0
kvě 23
1718
1
zář 22
3343
3
kvě 23
7369
0
lis 22
2251
0
říj 22
2950