From 68e33b347d5684214783ac65c5b4f0598f35c0f6 Mon Sep 17 00:00:00 2001 From: Aarni Koskela Date: Thu, 15 Oct 2020 11:44:02 +0200 Subject: Fixed #32105 -- Added template paths as ExceptionReporter class attributes. This allows replacement of the debugging templates without having to copy-paste the `get_traceback_html` and `get_traceback_text` functions into a subclass. Thanks to Nick Pope for review. --- docs/howto/error-reporting.txt | 16 ++++++++++++++++ docs/releases/3.2.txt | 5 ++++- 2 files changed, 20 insertions(+), 1 deletion(-) (limited to 'docs') diff --git a/docs/howto/error-reporting.txt b/docs/howto/error-reporting.txt index c77f1e955e..e2dbe7ca27 100644 --- a/docs/howto/error-reporting.txt +++ b/docs/howto/error-reporting.txt @@ -325,6 +325,22 @@ Your custom reporter class needs to inherit from .. class:: ExceptionReporter + .. attribute:: html_template_path + + .. versionadded:: 3.2 + + A :class:`pathlib.Path` representing the absolute filesystem path to a + template for rendering the HTML representation of the exception. + Defaults to the Django provided template. + + .. attribute:: text_template_path + + .. versionadded:: 3.2 + + A :class:`pathlib.Path` representing the absolute filesystem path to a + template for rendering the plain-text representation of the exception. + Defaults to the Django provided template. + .. method:: get_traceback_data() Return a dictionary containing traceback information. diff --git a/docs/releases/3.2.txt b/docs/releases/3.2.txt index 0c233f796b..d61f66733d 100644 --- a/docs/releases/3.2.txt +++ b/docs/releases/3.2.txt @@ -188,7 +188,10 @@ Email Error Reporting ~~~~~~~~~~~~~~~ -* ... +* Custom :class:`~django.views.debug.ExceptionReporter` subclasses can now set + the :attr:`~django.views.debug.ExceptionReporter.html_template_path` and + :attr:`~django.views.debug.ExceptionReporter.text_template_path` class + attributes to override the templates used to render exception reports. File Storage ~~~~~~~~~~~~ -- cgit v1.3