From 6b2e5f98962958b8480f629d0b336a3d88bf0066 Mon Sep 17 00:00:00 2001 From: Stephane Wirtel Date: Mon, 6 Sep 2010 16:06:45 +0200 Subject: [PATCH] [FIX] Use the currentThread function instead of current_thread bzr revid: stephane@openerp.com-20100906140645-zxt6los8sl54qzj0 --- bin/netsvc.py | 2 +- bin/sql_db.py | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) 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')