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/modules/loading.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/modules/loading.py')
| -rw-r--r-- | odoo/modules/loading.py | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/odoo/modules/loading.py b/odoo/modules/loading.py index bd58376a7b9..c06c219f7eb 100644 --- a/odoo/modules/loading.py +++ b/odoo/modules/loading.py @@ -20,7 +20,6 @@ import odoo.tools as tools from odoo import api, SUPERUSER_ID from odoo.modules.module import adapt_version, initialize_sys_path, load_openerp_module -from odoo.tools import pycompat _logger = logging.getLogger(__name__) _test_logger = logging.getLogger('odoo.tests') @@ -298,13 +297,13 @@ def load_modules(db, force_demo=False, status=None, update_module=False): _check_module_names(cr, itertools.chain(tools.config['init'], tools.config['update'])) - module_names = [k for k, v in pycompat.items(tools.config['init']) if v] + module_names = [k for k, v in tools.config['init'].items() if v] if module_names: modules = Module.search([('state', '=', 'uninstalled'), ('name', 'in', module_names)]) if modules: modules.button_install() - module_names = [k for k, v in pycompat.items(tools.config['update']) if v] + module_names = [k for k, v in tools.config['update'].items() if v] if module_names: modules = Module.search([('state', '=', 'installed'), ('name', 'in', module_names)]) if modules: @@ -392,7 +391,7 @@ def load_modules(db, force_demo=False, status=None, update_module=False): getattr(py_module, uninstall_hook)(cr, registry) Module = env['ir.module.module'] - Module.browse(pycompat.values(modules_to_remove)).module_uninstall() + Module.browse(modules_to_remove.values()).module_uninstall() # Recursive reload, should only happen once, because there should be no # modules to remove next time cr.commit() @@ -415,7 +414,7 @@ def load_modules(db, force_demo=False, status=None, update_module=False): _logger.info('Modules loaded.') # STEP 8: call _register_hook on every model - for model in pycompat.values(env): + for model in env.values(): model._register_hook() # STEP 9: save installed/updated modules for post-install tests |
