Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Reverted [3659], the 'name' field on Template objects and the signal …

…emitted whenever a template is rendered. Refs #2333.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@3666 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 2c2653db9fe3afdd73495ae90930898c589f4869 1 parent 97b9ad7
Adrian Holovaty authored August 27, 2006
6  django/template/__init__.py
@@ -60,8 +60,6 @@
60 60
 from django.template.context import Context, RequestContext, ContextPopException
61 61
 from django.utils.functional import curry
62 62
 from django.utils.text import smart_split
63  
-from django.dispatch import dispatcher
64  
-from django.template import signals
65 63
 
66 64
 __all__ = ('Template', 'Context', 'RequestContext', 'compile_string')
67 65
 
@@ -139,14 +137,13 @@ def reload(self):
139 137
         return self.source
140 138
 
141 139
 class Template(object):
142  
-    def __init__(self, template_string, origin=None, name='<Unknown Template>'):
  140
+    def __init__(self, template_string, origin=None):
143 141
         "Compilation stage"
144 142
         if settings.TEMPLATE_DEBUG and origin == None:
145 143
             origin = StringOrigin(template_string)
146 144
             # Could do some crazy stack-frame stuff to record where this string
147 145
             # came from...
148 146
         self.nodelist = compile_string(template_string, origin)
149  
-        self.name = name
150 147
 
151 148
     def __iter__(self):
152 149
         for node in self.nodelist:
@@ -155,7 +152,6 @@ def __iter__(self):
155 152
 
156 153
     def render(self, context):
157 154
         "Display stage -- can be called many times"
158  
-        dispatcher.send(signal=signals.template_rendered, sender=self, template=self, context=context)
159 155
         return self.nodelist.render(context)
160 156
 
161 157
 def compile_string(template_string, origin):
2  django/template/defaulttags.py
@@ -251,7 +251,7 @@ def render(self, context):
251 251
             output = ''
252 252
         if self.parsed:
253 253
             try:
254  
-                t = Template(output, name=self.filepath)
  254
+                t = Template(output)
255 255
                 return t.render(context)
256 256
             except TemplateSyntaxError, e:
257 257
                 if settings.DEBUG:
8  django/template/loader.py
@@ -76,16 +76,14 @@ def get_template(template_name):
76 76
     Returns a compiled Template object for the given template name,
77 77
     handling template inheritance recursively.
78 78
     """
79  
-    source, origin = find_template_source(template_name)
80  
-    template = get_template_from_string(source, origin, template_name)
81  
-    return template
  79
+    return get_template_from_string(*find_template_source(template_name))
82 80
 
83  
-def get_template_from_string(source, origin=None, name=None):
  81
+def get_template_from_string(source, origin=None):
84 82
     """
85 83
     Returns a compiled Template object for the given template code,
86 84
     handling template inheritance recursively.
87 85
     """
88  
-    return Template(source, origin, name)
  86
+    return Template(source, origin)
89 87
 
90 88
 def render_to_string(template_name, dictionary=None, context_instance=None):
91 89
     """
2  django/template/loader_tags.py
@@ -57,7 +57,7 @@ def get_parent(self, context):
57 57
         except TemplateDoesNotExist:
58 58
             raise TemplateSyntaxError, "Template %r cannot be extended, because it doesn't exist" % parent
59 59
         else:
60  
-            return get_template_from_string(source, origin, parent)
  60
+            return get_template_from_string(source, origin)
61 61
 
62 62
     def render(self, context):
63 63
         compiled_parent = self.get_parent(context)
1  django/template/signals.py
... ...
@@ -1 +0,0 @@
1  
-template_rendered=object()
6  django/views/debug.py
@@ -115,7 +115,7 @@ def technical_500_response(request, exc_type, exc_value, tb):
115 115
             'function': '?',
116 116
             'lineno': '?',
117 117
         }]
118  
-    t = Template(TECHNICAL_500_TEMPLATE, name='Technical 500 Template')
  118
+    t = Template(TECHNICAL_500_TEMPLATE)
119 119
     c = Context({
120 120
         'exception_type': exc_type.__name__,
121 121
         'exception_value': exc_value,
@@ -141,7 +141,7 @@ def technical_404_response(request, exception):
141 141
             # tried exists but is an empty list. The URLconf must've been empty.
142 142
             return empty_urlconf(request)
143 143
 
144  
-    t = Template(TECHNICAL_404_TEMPLATE, name='Technical 404 Template')
  144
+    t = Template(TECHNICAL_404_TEMPLATE)
145 145
     c = Context({
146 146
         'root_urlconf': settings.ROOT_URLCONF,
147 147
         'urlpatterns': tried,
@@ -154,7 +154,7 @@ def technical_404_response(request, exception):
154 154
 
155 155
 def empty_urlconf(request):
156 156
     "Create an empty URLconf 404 error response."
157  
-    t = Template(EMPTY_URLCONF_TEMPLATE, name='Empty URLConf Template')
  157
+    t = Template(EMPTY_URLCONF_TEMPLATE)
158 158
     c = Context({
159 159
         'project_name': settings.SETTINGS_MODULE.split('.')[0]
160 160
     })
2  django/views/static.py
@@ -81,7 +81,7 @@ def directory_index(path, fullpath):
81 81
     try:
82 82
         t = loader.get_template('static/directory_index')
83 83
     except TemplateDoesNotExist:
84  
-        t = Template(DEFAULT_DIRECTORY_INDEX_TEMPLATE, name='Default Directory Index Template')
  84
+        t = Template(DEFAULT_DIRECTORY_INDEX_TEMPLATE)
85 85
     files = []
86 86
     for f in os.listdir(fullpath):
87 87
         if not f.startswith('.'):

0 notes on commit 2c2653d

Please sign in to comment.
Something went wrong with that request. Please try again.