- # Initializing an osv_pool will call general code which will in turn
- # call get_db_and_pool (this function) to obtain the osv_pool being
- # initialized. Make it available in the pool_dic then remove it if
- # an exception is raised.
- pool_dic[db_name] = pool
- try:
- openerp.modules.load_modules(db, force_demo, status, update_module)
- except Exception:
- del pool_dic[db_name]
- raise
+def get_db_and_pool(db_name, force_demo=False, status=None, update_module=False):
+ """Create and return a database connection and a newly initialized registry."""
+ assert openerp.conf.deprecation.openerp_pooler
+ _logger.warning('openerp.pooler.get_db_and_pool() is deprecated.')
+ registry = RegistryManager.get(db_name, force_demo, status, update_module)
+ return registry._db, registry