aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAymeric Augustin2013-10-17 22:01:56 +0200
committerAymeric Augustin2013-10-17 22:01:56 +0200
commitd3be92802d92dc862dd5d51e3c982188393ad47d (patch)
tree5ea52d2390559798f3985046dda052dbef22a8dd
parent9b3920646edde08d8fbb57c4b9f1d204fc83f09d (diff)
downloaddjango-debug-toolbar-d3be92802d92dc862dd5d51e3c982188393ad47d.tar.bz2
Support non-ASCII SECRET_KEY settings.
Ref #28.
-rw-r--r--debug_toolbar/forms.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/debug_toolbar/forms.py b/debug_toolbar/forms.py
index 60d339c..cc05f30 100644
--- a/debug_toolbar/forms.py
+++ b/debug_toolbar/forms.py
@@ -6,7 +6,7 @@ import hashlib
from django import forms
from django.conf import settings
from django.db import connections
-from django.utils.encoding import smart_bytes
+from django.utils.encoding import force_text
from django.utils.functional import cached_property
from django.core.exceptions import ValidationError
@@ -76,8 +76,8 @@ class SQLSelectForm(forms.Form):
return reformat_sql(self.cursor.db.ops.last_executed_query(self.cursor, sql, params))
def make_hash(self, data):
- params = settings.SECRET_KEY + data['sql'] + data['params']
- return hashlib.sha1(smart_bytes(params)).hexdigest()
+ params = force_text(settings.SECRET_KEY) + data['sql'] + data['params']
+ return hashlib.sha1(params.encode('utf-8')).hexdigest()
@property
def connection(self):