[MERGE] lp:924783 (fix dropping database before any connection, contrib from Ronald Portier)

bzr revid: rco@openerp.com-20120201130957-ra3ot62j0bbxjnu1
This commit is contained in:
Raphael Collet 2012-02-01 14:09:57 +01:00
commit c86ddaad57
1 changed files with 3 additions and 1 deletions

View File

@ -509,8 +509,10 @@ def db_connect(db_name):
return Connection(_Pool, db_name)
def close_db(db_name):
global _Pool
""" You might want to call openerp.modules.registry.RegistryManager.delete(db_name) along this function."""
_Pool.close_all(dsn(db_name))
if _Pool:
_Pool.close_all(dsn(db_name))
ct = currentThread()
if hasattr(ct, 'dbname'):
delattr(ct, 'dbname')