Browse Source

Lepší informace o chybějící proměnné.

export_seznamu_prednasek
Jonas Havelka 2 years ago
parent
commit
2259ebe434
  1. 7
      mamweb/settings_common.py

7
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')

Loading…
Cancel
Save