def close_db(db_name): _Pool.close_all(dsn(db_name)) Agent.cancel(db_name) tools.cache.clean_caches_for_db(db_name) ct = currentThread() if hasattr(ct, 'dbname'): delattr(ct, 'dbname')
def __init__(self, **kwargs): import sys sys.argv = [sys.argv[0]] config = config_from_environment('OPENERP', [], **kwargs) import netsvc logging.disable(logging.CRITICAL) import tools for key, value in config.iteritems(): tools.config[key] = value tools.config.parse() from tools import config as default_config for key, value in config.iteritems(): default_config[key] = value # Disable cron default_config['cron'] = False self.config = default_config import pooler import workflow self.pooler = pooler self.db = None self.pool = None if 'db_name' in config: self.db_name = config['db_name'] try: from netsvc import Agent Agent.quit() except ImportError: pass
def __init__(self, **kwargs): """ Creates a new OpenERP service. :param kwargs: keyword arguments passed to the config """ if 'LOGGER_NAME' in kwargs: self.logger = logging.getLogger(kwargs['LOGGER_NAME']) else: self.logger = logging.getLogger('OpenERPService') import sys sys.argv = [sys.argv[0]] config = config_from_environment('OPENERP', [], **kwargs) import netsvc logging.disable(logging.CRITICAL) import tools for key, value in config.iteritems(): tools.config[key] = value if hasattr(tools.config, 'parse'): tools.config.parse() tools.config.parse() from tools import config as default_config for key, value in config.iteritems(): default_config[key] = value # Disable cron default_config['cron'] = False self.config = default_config import pooler import workflow self.pooler = pooler self.db = None self.pool = None self.DEFAULT_USER = 1 if 'db_name' in config: self.db_name = config['db_name'] try: from netsvc import Agent Agent.quit() except ImportError: pass
def close_db(db_name): _Pool.close_all(dsn(db_name)) Agent.cancel(db_name) tools.cache.clean_caches_for_db(db_name)