Skip to content
Snippets Groups Projects
Commit 3019f4a4 authored by Raphael Collet's avatar Raphael Collet
Browse files

[REM] openerp.pooler: remove

parent abc7d83e
Branches
Tags
No related merge requests found
......@@ -58,7 +58,6 @@ import loglevels
import modules
import netsvc
import osv
import pooler
import release
import report
import service
......
......@@ -34,8 +34,3 @@ allow_local_service = True
# See comments for allow_local_service above.
# Introduced around 2013.03.
allow_report_int_registration = True
# If True, the functions in openerp.pooler can be used.
# Introduced around 2013.03 (actually they are deprecated since much longer
# but no warning was dispayed in the logs).
openerp_pooler = True
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
""" Functions kept for backward compatibility.
They are simple wrappers around a global RegistryManager methods.
"""
import logging
import openerp.conf.deprecation
from openerp.modules.registry import RegistryManager
_logger = logging.getLogger(__name__)
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
def restart_pool(db_name, force_demo=False, status=None, update_module=False):
"""Delete an existing registry and return a database connection and a newly initialized registry."""
_logger.warning('openerp.pooler.restart_pool() is deprecated.')
assert openerp.conf.deprecation.openerp_pooler
registry = RegistryManager.new(db_name, force_demo, status, update_module)
return registry._db, registry
def get_db(db_name):
"""Return a database connection. The corresponding registry is initialized."""
assert openerp.conf.deprecation.openerp_pooler
return get_db_and_pool(db_name)[0]
def get_pool(db_name, force_demo=False, status=None, update_module=False):
"""Return a model registry."""
assert openerp.conf.deprecation.openerp_pooler
return get_db_and_pool(db_name, force_demo, status, update_module)[1]
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment