diff options
| author | Olivier Dony <odo@openerp.com> | 2017-08-18 18:43:46 +0200 |
|---|---|---|
| committer | Olivier Dony <odo@openerp.com> | 2017-08-20 23:25:54 +0200 |
| commit | 695716efb0f79f9a0e716952b1dcd433d866371a (patch) | |
| tree | 1b582a3469d12fc716d6252b4f239f0cd40da9e4 /odoo/sql_db.py | |
| parent | 589c0d7e2c3a44adc5d26aac8af08c0d06b97d5a (diff) | |
[FIX] P3: remove pycompat.{keys,items,values} helpers
Now that we're closer to switching to P3 for good, these helpers have
outlived their usefulness, and mostly add noise.
All remaining dict.iter*() or dict.view*() must be converted to the
normal keys(), values() or items() calls.
Whenever the result is likely to be used for more than the scope of a
loop, or when the dict needs to be modified during iteration, the calls
must be wrapped in a ``list()``, to protect the new P3 semantics.
Those cases are very exceptional.
Also removed some dead code or improved the API to remove unnecessary
conversions.
Diffstat (limited to 'odoo/sql_db.py')
| -rw-r--r-- | odoo/sql_db.py | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/odoo/sql_db.py b/odoo/sql_db.py index efc0e51972d..749abc69932 100644 --- a/odoo/sql_db.py +++ b/odoo/sql_db.py @@ -21,8 +21,6 @@ from psycopg2.extensions import ISOLATION_LEVEL_AUTOCOMMIT, ISOLATION_LEVEL_READ from psycopg2.pool import PoolError from werkzeug import urls -from .tools import pycompat - psycopg2.extensions.register_type(psycopg2.extensions.UNICODE) _logger = logging.getLogger(__name__) @@ -43,7 +41,7 @@ def undecimalize(symb, cr): return None return float(symb) -for name, typeoid in pycompat.items(types_mapping): +for name, typeoid in types_mapping.items(): psycopg2.extensions.register_type(psycopg2.extensions.new_type(typeoid, name, lambda x, cr: x)) psycopg2.extensions.register_type(psycopg2.extensions.new_type((700, 701, 1700,), 'float', undecimalize)) @@ -269,7 +267,7 @@ class Cursor(object): sqllogs = {'from': self.sql_from_log, 'into': self.sql_into_log} sum = 0 if sqllogs[type]: - sqllogitems = pycompat.items(sqllogs[type]) + sqllogitems = sqllogs[type].items() _logger.debug("SQL LOG %s:", type) for r in sorted(sqllogitems, key=lambda k: k[1]): delay = timedelta(microseconds=r[1][1]) |
