1
0
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:
Nick Johnson
2015-09-21 12:20:19 -07:00
committed by Tim Graham
parent 4b1416d372
commit 85c52743f7
2 changed files with 22 additions and 8 deletions

View File

@@ -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