mirror of
https://github.com/django/django.git
synced 2025-10-31 09:41:08 +00:00
Refs #18773 -- Improved template variable exception logging message.
This commit is contained in:
@@ -902,8 +902,13 @@ class Variable(object):
|
||||
else:
|
||||
raise
|
||||
except Exception as e:
|
||||
template_name = getattr(context, 'template_name', 'unknown')
|
||||
logger.debug('{} - {}'.format(template_name, e))
|
||||
template_name = getattr(context, 'template_name', None) or 'unknown'
|
||||
logger.debug(
|
||||
"Exception while resolving variable '%s' in template '%s'.",
|
||||
bit,
|
||||
template_name,
|
||||
exc_info=True,
|
||||
)
|
||||
|
||||
if getattr(e, 'silent_variable_failure', False):
|
||||
current = context.template.engine.string_if_invalid
|
||||
|
||||
Reference in New Issue
Block a user