[FIX] drop database fails when done before connecting to server.

lp bug: https://launchpad.net/bugs/924783 fixed

bzr revid: ronald@therp.nl-20120201113759-wi2kogl2x1lsxk7g
This commit is contained in:
Ronald Portier 2012-02-01 12:37:59 +01:00
parent ac205cd443
commit 64773ba357
2 changed files with 5 additions and 1 deletions

View File

@ -21,3 +21,5 @@ bin/pil*.py
.project
.pydevproject
.settings
profiledata
*.moved

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')