[FIX] If an error occurs when dropping the database, raise a normal exception (that can be pickle)
lp bug: https://launchpad.net/bugs/307069 fixed bzr revid: christophe@tinyerp.com-20081211112248-ljibz77ey2jkjtjd
This commit is contained in:
parent
9d96bb1c52
commit
c0152f5fcf
|
@ -148,10 +148,10 @@ class db(netsvc.Service):
|
|||
try:
|
||||
try:
|
||||
cr.execute('DROP DATABASE ' + db_name)
|
||||
except:
|
||||
except Exception, e:
|
||||
logger.notifyChannel("web-services", netsvc.LOG_ERROR,
|
||||
'DROP DB: %s failed' % (db_name,))
|
||||
raise
|
||||
'DROP DB: %s failed:\n%s' % (db_name, e))
|
||||
raise Exception("Couldn't drop database %s: %s" % (db_name, e))
|
||||
else:
|
||||
logger.notifyChannel("web-services", netsvc.LOG_INFO,
|
||||
'DROP DB: %s' % (db_name))
|
||||
|
|
|
@ -176,7 +176,7 @@ class PoolManager(object):
|
|||
if db_name not in PoolManager._pools:
|
||||
logger = netsvc.Logger()
|
||||
try:
|
||||
logger.notifyChannel('dbpool', netsvc.LOG_INFO, 'Connecting to %s' % (db_name.lower()))
|
||||
logger.notifyChannel('dbpool', netsvc.LOG_INFO, 'Connecting to %s' % (db_name,))
|
||||
PoolManager._pools[db_name] = ConnectionPool(ThreadedConnectionPool(0, PoolManager.maxconn, PoolManager.dsn(db_name)), db_name)
|
||||
except Exception, e:
|
||||
logger.notifyChannel('dbpool', netsvc.LOG_CRITICAL, 'Unable to connect to %s: %r' % (db_name, e))
|
||||
|
@ -186,6 +186,7 @@ class PoolManager(object):
|
|||
|
||||
def close(db_name):
|
||||
if db_name is PoolManager._pools:
|
||||
logger.notifyChannel('dbpool', netsvc.LOG_INFO, 'Closing all connections to %s' % (db_name,))
|
||||
PoolManager._pools[db_name].closeall()
|
||||
del PoolManager._pools[db_name]
|
||||
close = staticmethod(close)
|
||||
|
|
Loading…
Reference in New Issue