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:
@@ -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 ''
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user