diff options
| author | Claude Paroz <claude@2xlibre.net> | 2012-10-08 10:04:29 +0200 |
|---|---|---|
| committer | Claude Paroz <claude@2xlibre.net> | 2012-10-08 10:06:56 +0200 |
| commit | 4797ad80da57f3f8a7c029008f3e937240cf23e6 (patch) | |
| tree | 2ef506914b73d586d523f6dc2ef47e382d052796 | |
| parent | 88cc002e16635c9ad9f76b737366c5206f421c6e (diff) | |
[py3] Decoded the parsed source file encoding in debug view
| -rw-r--r-- | django/views/debug.py | 2 | ||||
| -rw-r--r-- | tests/regressiontests/views/tests/debug.py | 3 |
2 files changed, 4 insertions, 1 deletions
diff --git a/django/views/debug.py b/django/views/debug.py index ed99d8dfe6..c59fe31fc8 100644 --- a/django/views/debug.py +++ b/django/views/debug.py @@ -360,7 +360,7 @@ class ExceptionReporter(object): # (http://www.python.org/dev/peps/pep-0263/) match = re.search(br'coding[:=]\s*([-\w.]+)', line) if match: - encoding = match.group(1) + encoding = match.group(1).decode('ascii') break source = [six.text_type(sline, encoding, 'replace') for sline in source] diff --git a/tests/regressiontests/views/tests/debug.py b/tests/regressiontests/views/tests/debug.py index 8592b07efe..e616d184b8 100644 --- a/tests/regressiontests/views/tests/debug.py +++ b/tests/regressiontests/views/tests/debug.py @@ -1,3 +1,6 @@ +# -*- coding: utf-8 -*- +# This coding header is significant for tests, as the debug view is parsing +# files to search for such a header to decode the source file content from __future__ import absolute_import, unicode_literals import inspect |
