diff options
| author | Antony Lesuisse <al@openerp.com> | 2012-08-13 17:20:45 +0200 |
|---|---|---|
| committer | Antony Lesuisse <al@openerp.com> | 2012-08-13 17:20:45 +0200 |
| commit | 2a84ba0160f85e1dfd2d0ce2bb5746a774f4ab8f (patch) | |
| tree | 1c9915fda8b91c503aa7bb0f7b943086d7b728da /addons | |
| parent | 3e251640d23035a0c82af3e6c2bbd3eb765df960 (diff) | |
[IMP] use registry contextmanager
bzr revid: al@openerp.com-20120813152045-woeg16q10xkhiqgk
Diffstat (limited to 'addons')
| -rw-r--r-- | addons/web/controllers/main.py | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/addons/web/controllers/main.py b/addons/web/controllers/main.py index 01eb397f00f..ec356d89aa8 100644 --- a/addons/web/controllers/main.py +++ b/addons/web/controllers/main.py @@ -164,8 +164,7 @@ def module_installed_bypass_session(dbname): try: import openerp.modules.registry registry = openerp.modules.registry.RegistryManager.get(dbname) - cr = registry.db.cursor() - try: + with registry.cursor() as cr: m = registry.get('ir.module.module') # TODO The following code should move to ir.module.module.list_installed_modules() domain = [('state','=','installed'), ('name','in', loadable)] @@ -177,8 +176,6 @@ def module_installed_bypass_session(dbname): deps_read = registry.get('ir.module.module.dependency').read(cr, 1, deps, ['name']) dependencies = [i['name'] for i in deps_read] modules[module['name']] = dependencies - finally: - cr.close() except Exception,e: pass sorted_modules = module_topological_sort(modules) |
