Lepší informace o chybějící proměnné.
This commit is contained in:
		
							parent
							
								
									62b5e98812
								
							
						
					
					
						commit
						2259ebe434
					
				
					 1 changed files with 6 additions and 1 deletions
				
			
		|  | @ -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…
	
		Reference in a new issue