diff options
| author | Julien Castiaux <juc@odoo.com> | 2019-09-09 16:10:13 +0000 |
|---|---|---|
| committer | Julien Castiaux <juc@odoo.com> | 2019-09-16 09:31:38 +0000 |
| commit | 7c47eb185443af08a55b0045c6a78f74151dc083 (patch) | |
| tree | ff74975923ba2da758df1df16018e6b875d5337c /odoo/http.py | |
| parent | 760ab74f831dcbd2c2e48c5dbfbbf46df383cba7 (diff) | |
[IMP] module.py: deprecate openerp
[PEP-594] is deprecating the `imp` module, that module is used in
`module.py` in order to dynamically import addons using any of the
`odoo.addons` or `openerp.addons` import anchor.
We are deprecating `openerp` module/addons imports in v13 in order to
remove the support in v14 and greatly simplify how modules/addons are
loaded. If you are still using the old `import openerp` or `import
openerp.addons`, `import odoo` and `import odoo.addons` are drop-in
replacements.
The `odoo.modules.module.ad_paths` addon paths list has been deprecated
too. The list is now accessible on `odoo.addons.__path__` where they
are now directly loaded [2].
See also:
[PEP-594]: https://python.org/dev/peps/pep-0594/
[2]: https://packaging.python.org/guides/packaging-namespace-packages/
closes odoo/odoo#36597
Task: 2003936
Signed-off-by: Raphael Collet (rco) <rco@openerp.com>
Diffstat (limited to 'odoo/http.py')
| -rw-r--r-- | odoo/http.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/odoo/http.py b/odoo/http.py index cc26cd80a1f..9e0da1768fc 100644 --- a/odoo/http.py +++ b/odoo/http.py @@ -1299,14 +1299,15 @@ class Root(object): controllers and configure them. """ # TODO should we move this to ir.http so that only configured modules are served ? statics = {} - for addons_path in odoo.modules.module.ad_paths: + for addons_path in odoo.addons.__path__: for module in sorted(os.listdir(str(addons_path))): if module not in addons_manifest: mod_path = opj(addons_path, module) manifest_path = module_manifest(mod_path) path_static = opj(addons_path, module, 'static') if manifest_path and os.path.isdir(path_static): - manifest_data = open(manifest_path, 'rb').read() + with open(manifest_path, 'rb') as fd: + manifest_data = fd.read() manifest = ast.literal_eval(pycompat.to_text(manifest_data)) if not manifest.get('installable', True): continue |
