From 392f64842f678b6e29a2e5fac65a586d9c9a57ff Mon Sep 17 00:00:00 2001 From: Nick Johnson Date: Fri, 11 Sep 2015 16:35:21 -0700 Subject: Fixed #25373 -- Added warning logging for exceptions during {% include %} tag rendering. --- docs/ref/templates/builtins.txt | 11 ++++++++--- docs/releases/1.9.txt | 11 +++++++++-- 2 files changed, 17 insertions(+), 5 deletions(-) (limited to 'docs') diff --git a/docs/ref/templates/builtins.txt b/docs/ref/templates/builtins.txt index 1c5840d508..d032d7b1cc 100644 --- a/docs/ref/templates/builtins.txt +++ b/docs/ref/templates/builtins.txt @@ -673,9 +673,14 @@ if it's missing or has syntax errors), the behavior varies depending on the :class:`template engine's ` ``debug`` option (if not set, this option defaults to the value of :setting:`DEBUG`). When debug mode is turned on, an exception like :exc:`~django.template.TemplateDoesNotExist` or -:exc:`~django.template.TemplateSyntaxError` will be raised; otherwise -``{% include %}`` silences any exception that happens while rendering the -included template and returns an empty string. +:exc:`~django.template.TemplateSyntaxError` will be raised. When debug mode +is turned off, ``{% include %}`` logs a warning to the ``django.template`` +logger with the exception that happens while rendering the included template +and returns an empty string. + +.. versionchanged:: 1.9 + + Template logging now includes the warning logging mentioned above. .. note:: The :ttag:`include` tag should be considered as an implementation of diff --git a/docs/releases/1.9.txt b/docs/releases/1.9.txt index 0bb1523f57..bc30395b13 100644 --- a/docs/releases/1.9.txt +++ b/docs/releases/1.9.txt @@ -596,8 +596,15 @@ Templates * Added a :meth:`Context.setdefault() ` method. -* A warning will now be logged for missing context variables. These messages - will be logged to the :ref:`django.template ` logger. +* The :ref:`django.template ` logger was added and + includes the following messages: + + * A ``DEBUG`` level message for missing context variables. + + * A ``WARNING`` level message for uncaught exceptions raised + during the rendering of an ``{% include %}`` when debug mode is off + (helpful since ``{% include %}`` silences the exception and returns an + empty string). * The :ttag:`firstof` template tag supports storing the output in a variable using 'as'. -- cgit v1.3