[FIX] safe_eval: added time in the allowed modules.
- The reason is that on some older version of python (e.g. 2.5.2 on Windows), datetime.datetime.now() is doing an import time on itws own. lp bug: https://launchpad.net/bugs/703841 fixed bzr revid: vmt@openerp.com-20110322140124-huqn504k0y5xrkwa
This commit is contained in:
@@ -39,7 +39,10 @@ import os
|
||||
|
||||
__all__ = ['test_expr', 'literal_eval', 'safe_eval', 'const_eval', 'ext_eval' ]
|
||||
|
||||
_ALLOWED_MODULES = ['_strptime']
|
||||
# The time module is usually already provided in the safe_eval environment
|
||||
# but some code, e.g. datetime.datetime.now() (Windows/Python 2.5.2, bug
|
||||
# lp:703841), does import time.
|
||||
_ALLOWED_MODULES = ['_strptime', 'time']
|
||||
|
||||
_CONST_OPCODES = set(opmap[x] for x in [
|
||||
'POP_TOP', 'ROT_TWO', 'ROT_THREE', 'ROT_FOUR', 'DUP_TOP','POP_BLOCK','SETUP_LOOP',
|
||||
|
||||
Reference in New Issue
Block a user