Rewrite previous patch, sane cursor close checks.

bzr revid: p_christ@hol.gr-20090420183755-epdfdf6pgd6vc88m
This commit is contained in:
P. Christeas
2009-04-20 21:37:55 +03:00
parent 79d6288671
commit e0da6e16d1
+2 -2
View File
@@ -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,