diff options
| author | Olivier Laurent <olt@tinyerp.com> | 2008-08-12 16:44:56 +0200 |
|---|---|---|
| committer | Olivier Laurent <olt@tinyerp.com> | 2008-08-12 16:44:56 +0200 |
| commit | cc5a062faf56e86b39e604d9432b5237e87ad018 (patch) | |
| tree | 60e20e39eb7aaab21ff3f0325bbc0f3db4ec2735 /bin/pooler.py | |
| parent | 4c2a727132ddc99e1794d594a46d73cfc8ead353 (diff) | |
pep8
bzr revid: olt@tinyerp.com-20080812144456-xvh2y1ybziok9twi
Diffstat (limited to 'bin/pooler.py')
| -rw-r--r-- | bin/pooler.py | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/bin/pooler.py b/bin/pooler.py index 4f47a1f158b..e5c5b82be98 100644 --- a/bin/pooler.py +++ b/bin/pooler.py @@ -36,6 +36,7 @@ import netsvc db_dic = {} pool_dic = {} + def get_db_and_pool(db_name, force_demo=False, status=None, update_module=False): if not status: status={} @@ -46,7 +47,7 @@ def get_db_and_pool(db_name, force_demo=False, status=None, update_module=False) logger.notifyChannel('pooler', netsvc.LOG_INFO, 'Connecting to %s' % (db_name)) db = sql_db.db_connect(db_name) db_dic[db_name] = db - + if db_name in pool_dic: pool = pool_dic[db_name] else: @@ -60,11 +61,13 @@ def get_db_and_pool(db_name, force_demo=False, status=None, update_module=False) pool.get('ir.cron')._poolJobs(db.dbname) return db, pool + def restart_pool(db_name, force_demo=False, update_module=False): # del db_dic[db_name] del pool_dic[db_name] return get_db_and_pool(db_name, force_demo, update_module=update_module) + def close_db(db_name): if db_name in db_dic: db_dic[db_name].truedb.close() @@ -72,6 +75,7 @@ def close_db(db_name): if db_name in pool_dic: del pool_dic[db_name] + def get_db_only(db_name): if db_name in db_dic: db = db_dic[db_name] @@ -80,10 +84,12 @@ def get_db_only(db_name): db_dic[db_name] = db return db + def get_db(db_name): # print "get_db", db_name return get_db_and_pool(db_name)[0] + def get_pool(db_name, force_demo=False, status=None, update_module=False): # print "get_pool", db_name pool = get_db_and_pool(db_name, force_demo, status, update_module)[1] @@ -94,6 +100,7 @@ def get_pool(db_name, force_demo=False, status=None, update_module=False): return pool # return get_db_and_pool(db_name)[1] + def init(): global db # db = get_db_only(tools.config['db_name']) |
