summaryrefslogtreecommitdiff
path: root/django/views/debug.py
diff options
context:
space:
mode:
authorNick Pope <nick.pope@flightdataservices.com>2019-04-05 14:38:35 +0200
committerCarlton Gibson <carlton.gibson@noumenal.es>2019-04-05 16:35:01 +0200
commitefb257a01764855a71051d5bcc7fd66c5ad6d210 (patch)
tree16ce55154b0977b8b861092b12a17c447863af5a /django/views/debug.py
parent9012033138fa41b573d3e4e3f0dfa8b94a4719c6 (diff)
Fixed #30324 -- Forced utf-8 encoding when loading the template for the technical 500 debug page.
Regression in 50b8493. Related to ea542a9.
Diffstat (limited to 'django/views/debug.py')
-rw-r--r--django/views/debug.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/django/views/debug.py b/django/views/debug.py
index 601aca57af..18e961aa55 100644
--- a/django/views/debug.py
+++ b/django/views/debug.py
@@ -328,14 +328,14 @@ class ExceptionReporter:
def get_traceback_html(self):
"""Return HTML version of debug 500 HTTP error page."""
- with Path(CURRENT_DIR, 'templates', 'technical_500.html').open() as fh:
+ with Path(CURRENT_DIR, 'templates', 'technical_500.html').open(encoding='utf-8') as fh:
t = DEBUG_ENGINE.from_string(fh.read())
c = Context(self.get_traceback_data(), use_l10n=False)
return t.render(c)
def get_traceback_text(self):
"""Return plain text version of debug 500 HTTP error page."""
- with Path(CURRENT_DIR, 'templates', 'technical_500.txt').open() as fh:
+ with Path(CURRENT_DIR, 'templates', 'technical_500.txt').open(encoding='utf-8') as fh:
t = DEBUG_ENGINE.from_string(fh.read())
c = Context(self.get_traceback_data(), autoescape=False, use_l10n=False)
return t.render(c)