diff --git a/bin/netsvc.py b/bin/netsvc.py index 11f7ca5b695..52825c48f82 100644 --- a/bin/netsvc.py +++ b/bin/netsvc.py @@ -167,7 +167,7 @@ LEVEL_COLOR_MAPPING = { class DBFormatter(logging.Formatter): def format(self, record): - record.dbname = getattr(threading.current_thread(), 'dbname', '?') + record.dbname = getattr(threading.currentThread(), 'dbname', '?') return logging.Formatter.format(self, record) class ColoredFormatter(DBFormatter): diff --git a/bin/sql_db.py b/bin/sql_db.py index 438d513b0e4..193a709dd8d 100644 --- a/bin/sql_db.py +++ b/bin/sql_db.py @@ -21,7 +21,7 @@ __all__ = ['db_connect', 'close_db'] -from threading import current_thread +from threading import currentThread import logging from psycopg2.extensions import ISOLATION_LEVEL_AUTOCOMMIT, ISOLATION_LEVEL_READ_COMMITTED, ISOLATION_LEVEL_SERIALIZABLE from psycopg2.psycopg1 import cursor as psycopg1cursor @@ -365,13 +365,13 @@ def dsn_are_equals(first, second): _Pool = ConnectionPool(int(tools.config['db_maxconn'])) def db_connect(db_name): - current_thread().dbname = db_name + currentThread().dbname = db_name return Connection(_Pool, db_name) def close_db(db_name): _Pool.close_all(dsn(db_name)) tools.cache.clean_caches_for_db(db_name) - ct = current_thread() + ct = currentThread() if hasattr(ct, 'dbname'): delattr(ct, 'dbname')