diff options
| author | xmo-odoo <xmo@odoo.com> | 2017-04-27 13:59:33 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-04-27 13:59:33 +0200 |
| commit | 2e6a589f417af48e3322955ffff6e94b6d8a24e3 (patch) | |
| tree | aa613ecc1f74a9531a03de89aa2bdc7bb32eed3b /odoo/tools/safe_eval.py | |
| parent | de4a2216b953abb86094c9bfa5f45b1eaaa79d3d (diff) | |
[FIX] builtins removed from Python 3
* Reverse wrapper courtesy of @rco-odoo's original P3 branch
* thin compat module stripped down from werkzeug (to augment as needed)
issue 8530
Diffstat (limited to 'odoo/tools/safe_eval.py')
| -rw-r--r-- | odoo/tools/safe_eval.py | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/odoo/tools/safe_eval.py b/odoo/tools/safe_eval.py index 14020378c21..ebe97619e35 100644 --- a/odoo/tools/safe_eval.py +++ b/odoo/tools/safe_eval.py @@ -16,11 +16,14 @@ condition/math builtins. # - safe_eval in tryton http://hg.tryton.org/hgwebdir.cgi/trytond/rev/bbb5f73319ad from opcode import HAVE_ARGUMENT, opmap + +import functools from psycopg2 import OperationalError from types import CodeType import logging import werkzeug +from odoo.tools import pycompat from .misc import ustr import odoo @@ -226,7 +229,6 @@ _BUILTINS = { 'bool': bool, 'int': int, 'float': float, - 'long': long, 'enumerate': enumerate, 'dict': dict, 'list': list, @@ -236,7 +238,7 @@ _BUILTINS = { 'min': min, 'max': max, 'sum': sum, - 'reduce': reduce, + 'reduce': functools.reduce, 'filter': filter, 'round': round, 'len': len, @@ -246,11 +248,10 @@ _BUILTINS = { 'any': any, 'ord': ord, 'chr': chr, - 'cmp': cmp, 'divmod': divmod, 'isinstance': isinstance, 'range': range, - 'xrange': xrange, + 'xrange': pycompat.range, 'zip': zip, 'Exception': Exception, } |
