diff --git a/mamweb/settings_common.py b/mamweb/settings_common.py index 3f9edab6..54e0c6f1 100644 --- a/mamweb/settings_common.py +++ b/mamweb/settings_common.py @@ -10,6 +10,8 @@ https://docs.djangoproject.com/en/1.7/ref/settings/ # Build paths inside the project like this: os.path.join(BASE_DIR, ...) import os +import traceback + BASE_DIR = os.path.dirname(os.path.dirname(__file__)) # Application definition @@ -344,7 +346,10 @@ class InvalidTemplateVariable(str): def __mod__(self, variable): import logging logger = logging.getLogger(__name__) - logger.warning("Proměnná '%s' neexistuje" % variable) + for line in traceback.walk_stack(None): + if 'context' in line[0].f_locals and 'request' in line[0].f_locals['context']: + logger.warning("Proměnná '%s' neexistuje: %s" % (variable, line[0].f_locals['context']['request'])) + break return '' TEMPLATES[0]['OPTIONS']['string_if_invalid'] = InvalidTemplateVariable('%s')