summaryrefslogtreecommitdiff
path: root/openerpcommand/module.py
diff options
context:
space:
mode:
authorRaphael Collet <rco@openerp.com>2014-04-08 14:51:22 +0200
committerRaphael Collet <rco@openerp.com>2014-04-08 14:51:22 +0200
commit6bc60505f4e25d5ce7181f30d33692a8e7d08fe0 (patch)
treefec08c9fd2716b38973bec28db672e05ec6fdc91 /openerpcommand/module.py
parentb49f536baff6fab13884f4b2b6fdee1cb407f128 (diff)
[IMP] registry: add method get_cursor() to simply retrieve a new cursor, and refactor code to use it
bzr revid: rco@openerp.com-20140408125122-ki0zmin3m21k2itd
Diffstat (limited to 'openerpcommand/module.py')
-rw-r--r--openerpcommand/module.py5
1 files changed, 1 insertions, 4 deletions
diff --git a/openerpcommand/module.py b/openerpcommand/module.py
index 550e0a2be28..284c0186785 100644
--- a/openerpcommand/module.py
+++ b/openerpcommand/module.py
@@ -33,12 +33,9 @@ def run(args):
xs = []
ir_module_module = registry.get('ir.module.module')
- cr = registry.db.cursor() # TODO context manager
- try:
+ with registry.cursor() as cr:
ids = ir_module_module.search(cr, openerp.SUPERUSER_ID, [], {})
xs = ir_module_module.read(cr, openerp.SUPERUSER_ID, ids, [], {})
- finally:
- cr.close()
if xs:
print "Modules (database `%s`):" % (args.database,)