diff options
| author | P. Christeas <p_christ@hol.gr> | 2009-01-22 19:59:10 +0200 |
|---|---|---|
| committer | P. Christeas <p_christ@hol.gr> | 2009-01-22 19:59:10 +0200 |
| commit | 1f6278b32c2e675bcf316478ca0f0f886be14721 (patch) | |
| tree | 597e8e618dee0f9bc21ebd20cb3ac9916d08830f /bin/sql_db.py | |
| parent | 69bdb830a49c022776ea49b1f1acbd4a18b8ac88 (diff) | |
| parent | b926a1eb35bab43952874a907b2dcb16f23db4cf (diff) | |
Merge branch 'master' of openobject-server into mdv-gpl3-py26
Conflicts:
bin/addons/base/ir/ir.xml
bin/osv/orm.py
bin/sql_db.py
bin/tools/config.py
bzr revid: p_christ@hol.gr-20090122175910-4apjfo1p7iokatm6
Diffstat (limited to 'bin/sql_db.py')
| -rw-r--r-- | bin/sql_db.py | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/bin/sql_db.py b/bin/sql_db.py index 8cc65cd9e48..219d4809b3b 100644 --- a/bin/sql_db.py +++ b/bin/sql_db.py @@ -84,21 +84,23 @@ class Cursor(object): self._obj = self._cnx.cursor(cursor_factory=psycopg1cursor) self.autocommit(False) self.dbname = pool.dbname - - from inspect import stack - self.__caller = tuple(stack()[2][1:3]) + + if tools.config['log_level'] in (netsvc.LOG_DEBUG, netsvc.LOG_DEBUG_RPC): + from inspect import stack + self.__caller = tuple(stack()[2][1:3]) def __del__(self): if hasattr(self, '_obj'): - # Oops. 'self' has not been closed explicitly. - # The cursor will be deleted by the garbage collector, - # but the database connection is not put back into the connection - # pool, preventing some operation on the database like dropping it. - # This can also lead to a server overload. - msg = "Cursor not closed explicitly\n" \ - "Cursor was created at %s:%s" % self.__caller - - log(msg, netsvc.LOG_WARNING) + if tools.config['log_level'] in (netsvc.LOG_DEBUG, netsvc.LOG_DEBUG_RPC): + # Oops. 'self' has not been closed explicitly. + # The cursor will be deleted by the garbage collector, + # but the database connection is not put back into the connection + # pool, preventing some operation on the database like dropping it. + # This can also lead to a server overload. + msg = "Cursor not closed explicitly\n" \ + "Cursor was created at %s:%s" % self.__caller + + log(msg, netsvc.LOG_WARNING) self.close() @check |
