Ticket #15053: patch1.2.r15173

File patch1.2.r15173, 1.6 KB (added by Pablo Martín, 14 years ago)
Line 
1Index: template/base.py
2===================================================================
3--- template/base.py (revisión: 15174)
4+++ template/base.py (copia de trabajo)
5@@ -195,6 +195,7 @@
6 token = Token(TOKEN_COMMENT, content)
7 else:
8 token = Token(TOKEN_TEXT, token_string)
9+ token.source = self.origin
10 token.lineno = self.lineno
11 self.lineno += token_string.count('\n')
12 return token
13@@ -268,6 +269,7 @@
14 raise TemplateSyntaxError("%r must be the first tag in the template." % node)
15 if isinstance(nodelist, NodeList) and not isinstance(node, TextNode):
16 nodelist.contains_nontext = True
17+ node.source = token.source
18 nodelist.append(node)
19
20 def enter_command(self, command, token):
21Index: template/loader.py
22===================================================================
23--- template/loader.py (revisión: 15174)
24+++ template/loader.py (copia de trabajo)
25@@ -78,11 +78,19 @@
26 def reload(self):
27 return self.loader(self.loadname, self.dirs)[0]
28
29+
30+class LoaderOriginFake(object):
31+
32+ def __init__(self, display_name, loader, name, dirs):
33+ self.name = display_name
34+ self.loader, self.loadname, self.dirs = loader, name, dirs
35+
36+
37 def make_origin(display_name, loader, name, dirs):
38 if settings.TEMPLATE_DEBUG and display_name:
39 return LoaderOrigin(display_name, loader, name, dirs)
40 else:
41- return None
42+ return [LoaderOriginFake(display_name, loader, name, dirs)]
43
44 def find_template_loader(loader):
45 if isinstance(loader, (tuple, list)):
Back to Top