[FIX] sql_db: connection pool created lazily.
- This is necessary to give a chance to change the config just after importing openerp. bzr revid: vmt@openerp.com-20110421103125-3lv609wnu3vh2m4f
This commit is contained in:
parent
2356412aea
commit
7008aa3e0e
|
@ -374,9 +374,12 @@ def dsn_are_equals(first, second):
|
|||
return key(first) == key(second)
|
||||
|
||||
|
||||
_Pool = ConnectionPool(int(tools.config['db_maxconn']))
|
||||
_Pool = None
|
||||
|
||||
def db_connect(db_name):
|
||||
global _Pool
|
||||
if _Pool is None:
|
||||
_Pool = ConnectionPool(int(tools.config['db_maxconn']))
|
||||
currentThread().dbname = db_name
|
||||
return Connection(_Pool, db_name)
|
||||
|
||||
|
|
Loading…
Reference in New Issue