From 2259ebe434373a6895bc09c3f10b9ebc1450f2fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jon=C3=A1=C5=A1=20Havelka?= Date: Thu, 3 Feb 2022 12:22:32 +0100 Subject: [PATCH] =?UTF-8?q?Lep=C5=A1=C3=AD=20informace=20o=20chyb=C4=9Bj?= =?UTF-8?q?=C3=ADc=C3=AD=20prom=C4=9Bnn=C3=A9.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- mamweb/settings_common.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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')