summaryrefslogtreecommitdiff
path: root/bin/sql_db.py
diff options
context:
space:
mode:
authorP. Christeas <p_christ@hol.gr>2009-04-20 21:37:55 +0300
committerP. Christeas <p_christ@hol.gr>2009-04-20 21:37:55 +0300
commite0da6e16d1801fc16f8ac5cb2d82dd21ed5538d0 (patch)
tree7d00963804287a43c21cad66bfe5466581d3b773 /bin/sql_db.py
parent79d62886715d113d945a2f1c0b4469b811741fe0 (diff)
Rewrite previous patch, sane cursor close checks.
bzr revid: p_christ@hol.gr-20090420183755-epdfdf6pgd6vc88m
Diffstat (limited to 'bin/sql_db.py')
-rw-r--r--bin/sql_db.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/bin/sql_db.py b/bin/sql_db.py
index 93e95e82bfb..256df23a1e0 100644
--- a/bin/sql_db.py
+++ b/bin/sql_db.py
@@ -73,7 +73,7 @@ class Cursor(object):
@wraps(f)
def wrapper(self, *args, **kwargs):
- if not hasattr(self, '_obj'):
+ if not '_obj' in self.__dict__:
raise psycopg2.ProgrammingError('Unable to use the cursor after having closed it')
return f(self, *args, **kwargs)
return wrapper
@@ -91,7 +91,7 @@ class Cursor(object):
self.__caller = tuple(stack()[2][1:3])
def __del__(self):
- if hasattr(self.__dict__, '_obj'):
+ if '_obj' in self.__dict__ :
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,