mirror of
https://github.com/bringout/oca-ocb-core.git
synced 2026-04-20 04:32:07 +02:00
18.0 vanilla
This commit is contained in:
parent
d72e748793
commit
0a7ae8db93
337 changed files with 399651 additions and 232598 deletions
|
|
@ -19,14 +19,12 @@ import functools
|
|||
import logging
|
||||
import sys
|
||||
import types
|
||||
from opcode import HAVE_ARGUMENT, opmap, opname
|
||||
from opcode import opmap, opname
|
||||
from types import CodeType
|
||||
|
||||
import werkzeug
|
||||
from psycopg2 import OperationalError
|
||||
|
||||
from .misc import ustr
|
||||
|
||||
import odoo
|
||||
|
||||
unsafe_eval = eval
|
||||
|
|
@ -261,7 +259,7 @@ def test_expr(expr, allowed_codes, mode="eval", filename=None):
|
|||
except (SyntaxError, TypeError, ValueError):
|
||||
raise
|
||||
except Exception as e:
|
||||
raise ValueError('"%s" while compiling\n%r' % (ustr(e), expr))
|
||||
raise ValueError('%r while compiling\n%r' % (e, expr))
|
||||
assert_valid_codeobj(allowed_codes, code_obj, expr)
|
||||
return code_obj
|
||||
|
||||
|
|
@ -410,7 +408,7 @@ def safe_eval(expr, globals_dict=None, locals_dict=None, mode="eval", nocopy=Fal
|
|||
except ZeroDivisionError:
|
||||
raise
|
||||
except Exception as e:
|
||||
raise ValueError('%s: "%s" while evaluating\n%r' % (ustr(type(e)), ustr(e), expr))
|
||||
raise ValueError('%r while evaluating\n%r' % (e, expr))
|
||||
def test_python_expr(expr, mode="eval"):
|
||||
try:
|
||||
test_expr(expr, _SAFE_OPCODES, mode=mode)
|
||||
|
|
@ -425,7 +423,7 @@ def test_python_expr(expr, mode="eval"):
|
|||
}
|
||||
msg = "%s : %s at line %d\n%s" % (type(err).__name__, error['message'], error['lineno'], error['error_line'])
|
||||
else:
|
||||
msg = ustr(err)
|
||||
msg = str(err)
|
||||
return msg
|
||||
return False
|
||||
|
||||
|
|
@ -474,6 +472,10 @@ import dateutil
|
|||
mods = ['parser', 'relativedelta', 'rrule', 'tz']
|
||||
for mod in mods:
|
||||
__import__('dateutil.%s' % mod)
|
||||
# make sure to patch pytz before exposing
|
||||
from odoo._monkeypatches.pytz import patch_pytz # noqa: E402, F401
|
||||
patch_pytz()
|
||||
|
||||
datetime = wrap_module(__import__('datetime'), ['date', 'datetime', 'time', 'timedelta', 'timezone', 'tzinfo', 'MAXYEAR', 'MINYEAR'])
|
||||
dateutil = wrap_module(dateutil, {
|
||||
"tz": ["UTC", "tzutc"],
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue