summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorChristophe Simonis <christophe@tinyerp.com>2008-12-11 12:22:48 +0100
committerChristophe Simonis <christophe@tinyerp.com>2008-12-11 12:22:48 +0100
commitc0152f5fcf0cd3c995bbdb0979801bc0abbe1af6 (patch)
tree74f3183c35b98038881ee9f8e94c4c535d319b07 /bin
parent9d96bb1c52ccd85ed5a400fdb5847073430b683b (diff)
[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
Diffstat (limited to 'bin')
-rw-r--r--bin/service/web_services.py6
-rw-r--r--bin/sql_db.py3
2 files changed, 5 insertions, 4 deletions
diff --git a/bin/service/web_services.py b/bin/service/web_services.py
index 71821d15fe3..ce395d3cd67 100644
--- a/bin/service/web_services.py
+++ b/bin/service/web_services.py
@@ -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))
diff --git a/bin/sql_db.py b/bin/sql_db.py
index ccf57d0c718..4286a98da2f 100644
--- a/bin/sql_db.py
+++ b/bin/sql_db.py
@@ -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)