diff options
| author | Aymeric Augustin | 2013-10-17 22:01:56 +0200 |
|---|---|---|
| committer | Aymeric Augustin | 2013-10-17 22:01:56 +0200 |
| commit | d3be92802d92dc862dd5d51e3c982188393ad47d (patch) | |
| tree | 5ea52d2390559798f3985046dda052dbef22a8dd | |
| parent | 9b3920646edde08d8fbb57c4b9f1d204fc83f09d (diff) | |
| download | django-debug-toolbar-d3be92802d92dc862dd5d51e3c982188393ad47d.tar.bz2 | |
Support non-ASCII SECRET_KEY settings.
Ref #28.
| -rw-r--r-- | debug_toolbar/forms.py | 6 |
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): |
