diff --git a/debug_toolbar/urls.py b/debug_toolbar/urls.py index 77491e3ca..ff4413490 100644 --- a/debug_toolbar/urls.py +++ b/debug_toolbar/urls.py @@ -4,7 +4,7 @@ These should not be loaded explicitly; the debug toolbar middleware will patch this into the urlconf for the request. """ -from django.conf.urls.defaults import * +from django.conf.urls import * from django.conf import settings _PREFIX = '__debug__' diff --git a/debug_toolbar/views.py b/debug_toolbar/views.py index bc6cdb33f..c4711edbb 100644 --- a/debug_toolbar/views.py +++ b/debug_toolbar/views.py @@ -5,13 +5,13 @@ """ import os +import hashlib import django.views.static from django.conf import settings from django.db import connection from django.http import HttpResponseBadRequest from django.shortcuts import render_to_response from django.utils import simplejson -from django.utils.hashcompat import sha_constructor class InvalidSQLError(Exception): def __init__(self, value): @@ -39,7 +39,7 @@ def sql_select(request): from debug_toolbar.panels.sql import reformat_sql sql = request.GET.get('sql', '') params = request.GET.get('params', '') - hash = sha_constructor(settings.SECRET_KEY + sql + params).hexdigest() + hash = hashlib.sha1(settings.SECRET_KEY + sql + params).hexdigest() if hash != request.GET.get('hash', ''): return HttpResponseBadRequest('Tamper alert') # SQL Tampering alert if sql.lower().strip().startswith('select'): @@ -71,7 +71,7 @@ def sql_explain(request): from debug_toolbar.panels.sql import reformat_sql sql = request.GET.get('sql', '') params = request.GET.get('params', '') - hash = sha_constructor(settings.SECRET_KEY + sql + params).hexdigest() + hash = hashlib.sha1(settings.SECRET_KEY + sql + params).hexdigest() if hash != request.GET.get('hash', ''): return HttpResponseBadRequest('Tamper alert') # SQL Tampering alert if sql.lower().strip().startswith('select'): @@ -111,7 +111,7 @@ def sql_profile(request): from debug_toolbar.panels.sql import reformat_sql sql = request.GET.get('sql', '') params = request.GET.get('params', '') - hash = sha_constructor(settings.SECRET_KEY + sql + params).hexdigest() + hash = hashlib.sha1(settings.SECRET_KEY + sql + params).hexdigest() if hash != request.GET.get('hash', ''): return HttpResponseBadRequest('Tamper alert') # SQL Tampering alert if sql.lower().strip().startswith('select'):