Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix deprecation for django.db.backends.util #125

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions devserver/modules/sql.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from django.db import connection
connections = {'default': connection}

from django.db.backends import util
from django.db.backends import utils
from django.conf import settings as django_settings
#from django.template import Node

Expand Down Expand Up @@ -52,9 +52,9 @@ def truncate_sql(sql, aggregates=True):
import django
version = float('.'.join([str(x) for x in django.VERSION[:2]]))
if version >= 1.6:
DatabaseStatTracker = util.CursorWrapper
DatabaseStatTracker = utils.CursorWrapper
else:
DatabaseStatTracker = util.CursorDebugWrapper
DatabaseStatTracker = utils.CursorDebugWrapper


class DatabaseStatTracker(DatabaseStatTracker):
Expand Down Expand Up @@ -126,14 +126,14 @@ class SQLRealTimeModule(DevServerModule):
logger_name = 'sql'

def process_init(self, request):
if not issubclass(util.CursorDebugWrapper, DatabaseStatTracker):
self.old_cursor = util.CursorDebugWrapper
util.CursorDebugWrapper = DatabaseStatTracker
if not issubclass(utils.CursorDebugWrapper, DatabaseStatTracker):
self.old_cursor = utils.CursorDebugWrapper
utils.CursorDebugWrapper = DatabaseStatTracker
DatabaseStatTracker.logger = self.logger

def process_complete(self, request):
if issubclass(util.CursorDebugWrapper, DatabaseStatTracker):
util.CursorDebugWrapper = self.old_cursor
if issubclass(utils.CursorDebugWrapper, DatabaseStatTracker):
utils.CursorDebugWrapper = self.old_cursor


class SQLSummaryModule(DevServerModule):
Expand Down