Skip to content

Commit

Permalink
Fix deprecation for django.db.backends.util
Browse files Browse the repository at this point in the history
Renamed django.db.backends.util to utils, ref:
sql.py:15: RemovedInDjango19Warning: The django.db.backends.util module has
been renamed. Use django.db.backends.utils instead.
  • Loading branch information
Kristian Berg committed Dec 1, 2015
1 parent e6c882f commit 4627992
Showing 1 changed file with 8 additions and 8 deletions.
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

0 comments on commit 4627992

Please sign in to comment.