1
0
mirror of https://github.com/django/django.git synced 2025-10-31 09:41:08 +00:00

Fixed #25373 -- Added warning logging for exceptions during {% include %} tag rendering.

This commit is contained in:
Nick Johnson
2015-09-11 16:35:21 -07:00
committed by Tim Graham
parent 85c52743f7
commit 392f64842f
4 changed files with 75 additions and 8 deletions

View File

@@ -1,3 +1,4 @@
import logging
from collections import defaultdict
from django.utils import six
@@ -12,6 +13,8 @@ register = Library()
BLOCK_CONTEXT_KEY = 'block_context'
logger = logging.getLogger('django.template')
class ExtendsError(Exception):
pass
@@ -207,6 +210,13 @@ class IncludeNode(Node):
except Exception:
if context.template.engine.debug:
raise
template_name = getattr(context, 'template_name', None) or 'unknown'
logger.warn(
"Exception raised while rendering {%% include %%} for "
"template '%s'. Empty string rendered instead.",
template_name,
exc_info=True,
)
return ''