Fixed #15297 -- Corrected an attribute naming regressoin from fixing #9964. Thanks to leonov for the report.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@15527 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Russell Keith-Magee 2011-02-14 00:06:52 +00:00
parent 337b6786fd
commit 7e46b17000
1 changed files with 7 additions and 7 deletions

View File

@ -10,13 +10,13 @@ logger = getLogger('django.db.backends')
class CursorWrapper(object): class CursorWrapper(object):
def __init__(self, cursor, connection): def __init__(self, cursor, db):
self.cursor = cursor self.cursor = cursor
self.connection = connection self.db = db
def __getattr__(self, attr): def __getattr__(self, attr):
if self.connection.is_managed(): if self.db.is_managed():
self.connection.set_dirty() self.db.set_dirty()
if attr in self.__dict__: if attr in self.__dict__:
return self.__dict__[attr] return self.__dict__[attr]
else: else:
@ -35,8 +35,8 @@ class CursorDebugWrapper(CursorWrapper):
finally: finally:
stop = time() stop = time()
duration = stop - start duration = stop - start
sql = self.connection.ops.last_executed_query(self.cursor, sql, params) sql = self.db.ops.last_executed_query(self.cursor, sql, params)
self.connection.queries.append({ self.db.queries.append({
'sql': sql, 'sql': sql,
'time': "%.3f" % duration, 'time': "%.3f" % duration,
}) })
@ -51,7 +51,7 @@ class CursorDebugWrapper(CursorWrapper):
finally: finally:
stop = time() stop = time()
duration = stop - start duration = stop - start
self.connection.queries.append({ self.db.queries.append({
'sql': '%s times: %s' % (len(param_list), sql), 'sql': '%s times: %s' % (len(param_list), sql),
'time': "%.3f" % duration, 'time': "%.3f" % duration,
}) })