Author: adrian
Date: 2006-08-27 13:10:32 -0500 (Sun, 27 Aug 2006)
New Revision: 3666
Removed:
django/trunk/django/template/signals.py
Modified:
django/trunk/django/template/__init__.py
django/trunk/django/template/defaulttags.py
django/trunk/django/template/loader.py
django/trunk/django/template/loader_tags.py
django/trunk/django/views/debug.py
django/trunk/django/views/static.py
Log:
Reverted [3659], the 'name' field on Template objects and the signal emitted
whenever a template is rendered. Refs #2333.
Modified: django/trunk/django/template/__init__.py
===================================================================
--- django/trunk/django/template/__init__.py 2006-08-27 16:36:27 UTC (rev
3665)
+++ django/trunk/django/template/__init__.py 2006-08-27 18:10:32 UTC (rev
3666)
@@ -60,8 +60,6 @@
from django.template.context import Context, RequestContext,
ContextPopException
from django.utils.functional import curry
from django.utils.text import smart_split
-from django.dispatch import dispatcher
-from django.template import signals
__all__ = ('Template', 'Context', 'RequestContext', 'compile_string')
@@ -139,14 +137,13 @@
return self.source
class Template(object):
- def __init__(self, template_string, origin=None, name='<Unknown
Template>'):
+ def __init__(self, template_string, origin=None):
"Compilation stage"
if settings.TEMPLATE_DEBUG and origin == None:
origin = StringOrigin(template_string)
# Could do some crazy stack-frame stuff to record where this string
# came from...
self.nodelist = compile_string(template_string, origin)
- self.name = name
def __iter__(self):
for node in self.nodelist:
@@ -155,7 +152,6 @@
def render(self, context):
"Display stage -- can be called many times"
- dispatcher.send(signal=signals.template_rendered, sender=self,
template=self, context=context)
return self.nodelist.render(context)
def compile_string(template_string, origin):
Modified: django/trunk/django/template/defaulttags.py
===================================================================
--- django/trunk/django/template/defaulttags.py 2006-08-27 16:36:27 UTC (rev
3665)
+++ django/trunk/django/template/defaulttags.py 2006-08-27 18:10:32 UTC (rev
3666)
@@ -251,7 +251,7 @@
output = ''
if self.parsed:
try:
- t = Template(output, name=self.filepath)
+ t = Template(output)
return t.render(context)
except TemplateSyntaxError, e:
if settings.DEBUG:
Modified: django/trunk/django/template/loader.py
===================================================================
--- django/trunk/django/template/loader.py 2006-08-27 16:36:27 UTC (rev
3665)
+++ django/trunk/django/template/loader.py 2006-08-27 18:10:32 UTC (rev
3666)
@@ -76,16 +76,14 @@
Returns a compiled Template object for the given template name,
handling template inheritance recursively.
"""
- source, origin = find_template_source(template_name)
- template = get_template_from_string(source, origin, template_name)
- return template
+ return get_template_from_string(*find_template_source(template_name))
-def get_template_from_string(source, origin=None, name=None):
+def get_template_from_string(source, origin=None):
"""
Returns a compiled Template object for the given template code,
handling template inheritance recursively.
"""
- return Template(source, origin, name)
+ return Template(source, origin)
def render_to_string(template_name, dictionary=None, context_instance=None):
"""
Modified: django/trunk/django/template/loader_tags.py
===================================================================
--- django/trunk/django/template/loader_tags.py 2006-08-27 16:36:27 UTC (rev
3665)
+++ django/trunk/django/template/loader_tags.py 2006-08-27 18:10:32 UTC (rev
3666)
@@ -57,7 +57,7 @@
except TemplateDoesNotExist:
raise TemplateSyntaxError, "Template %r cannot be extended,
because it doesn't exist" % parent
else:
- return get_template_from_string(source, origin, parent)
+ return get_template_from_string(source, origin)
def render(self, context):
compiled_parent = self.get_parent(context)
Deleted: django/trunk/django/template/signals.py
===================================================================
--- django/trunk/django/template/signals.py 2006-08-27 16:36:27 UTC (rev
3665)
+++ django/trunk/django/template/signals.py 2006-08-27 18:10:32 UTC (rev
3666)
@@ -1 +0,0 @@
-template_rendered=object()
\ No newline at end of file
Modified: django/trunk/django/views/debug.py
===================================================================
--- django/trunk/django/views/debug.py 2006-08-27 16:36:27 UTC (rev 3665)
+++ django/trunk/django/views/debug.py 2006-08-27 18:10:32 UTC (rev 3666)
@@ -115,7 +115,7 @@
'function': '?',
'lineno': '?',
}]
- t = Template(TECHNICAL_500_TEMPLATE, name='Technical 500 Template')
+ t = Template(TECHNICAL_500_TEMPLATE)
c = Context({
'exception_type': exc_type.__name__,
'exception_value': exc_value,
@@ -141,7 +141,7 @@
# tried exists but is an empty list. The URLconf must've been
empty.
return empty_urlconf(request)
- t = Template(TECHNICAL_404_TEMPLATE, name='Technical 404 Template')
+ t = Template(TECHNICAL_404_TEMPLATE)
c = Context({
'root_urlconf': settings.ROOT_URLCONF,
'urlpatterns': tried,
@@ -154,7 +154,7 @@
def empty_urlconf(request):
"Create an empty URLconf 404 error response."
- t = Template(EMPTY_URLCONF_TEMPLATE, name='Empty URLConf Template')
+ t = Template(EMPTY_URLCONF_TEMPLATE)
c = Context({
'project_name': settings.SETTINGS_MODULE.split('.')[0]
})
Modified: django/trunk/django/views/static.py
===================================================================
--- django/trunk/django/views/static.py 2006-08-27 16:36:27 UTC (rev 3665)
+++ django/trunk/django/views/static.py 2006-08-27 18:10:32 UTC (rev 3666)
@@ -81,7 +81,7 @@
try:
t = loader.get_template('static/directory_index')
except TemplateDoesNotExist:
- t = Template(DEFAULT_DIRECTORY_INDEX_TEMPLATE, name='Default Directory
Index Template')
+ t = Template(DEFAULT_DIRECTORY_INDEX_TEMPLATE)
files = []
for f in os.listdir(fullpath):
if not f.startswith('.'):
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-updates
-~----------~----~----~----~------~----~------~--~---