Changeset 3664
- Timestamp:
- 08/27/06 11:23:57 (2 years ago)
- Files:
-
- django/branches/multiple-db-support/django/template/defaulttags.py (modified) (1 diff)
- django/branches/multiple-db-support/django/template/__init__.py (modified) (4 diffs)
- django/branches/multiple-db-support/django/template/loader.py (modified) (1 diff)
- django/branches/multiple-db-support/django/template/loader_tags.py (modified) (1 diff)
- django/branches/multiple-db-support/django/views/debug.py (modified) (3 diffs)
- django/branches/multiple-db-support/django/views/static.py (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
django/branches/multiple-db-support/django/template/defaulttags.py
r3303 r3664 252 252 if self.parsed: 253 253 try: 254 t = Template(output )254 t = Template(output, name=self.filepath) 255 255 return t.render(context) 256 256 except TemplateSyntaxError, e: django/branches/multiple-db-support/django/template/__init__.py
r3502 r3664 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 63 65 64 66 __all__ = ('Template', 'Context', 'RequestContext', 'compile_string') … … 138 140 139 141 class Template(object): 140 def __init__(self, template_string, origin=None ):142 def __init__(self, template_string, origin=None, name='<Unknown Template>'): 141 143 "Compilation stage" 142 144 if settings.TEMPLATE_DEBUG and origin == None: … … 145 147 # came from... 146 148 self.nodelist = compile_string(template_string, origin) 149 self.name = name 147 150 148 151 def __iter__(self): … … 153 156 def render(self, context): 154 157 "Display stage -- can be called many times" 158 dispatcher.send(signal=signals.template_rendered, sender=self, template=self, context=context) 155 159 return self.nodelist.render(context) 156 160 django/branches/multiple-db-support/django/template/loader.py
r3427 r3664 77 77 handling template inheritance recursively. 78 78 """ 79 return get_template_from_string(*find_template_source(template_name)) 79 source, origin = find_template_source(template_name) 80 template = get_template_from_string(source, origin, template_name) 81 return template 80 82 81 def get_template_from_string(source, origin=None ):83 def get_template_from_string(source, origin=None, name=None): 82 84 """ 83 85 Returns a compiled Template object for the given template code, 84 86 handling template inheritance recursively. 85 87 """ 86 return Template(source, origin )88 return Template(source, origin, name) 87 89 88 90 def render_to_string(template_name, dictionary=None, context_instance=None): django/branches/multiple-db-support/django/template/loader_tags.py
r3502 r3664 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 )60 return get_template_from_string(source, origin, parent) 61 61 62 62 def render(self, context): django/branches/multiple-db-support/django/views/debug.py
r3427 r3664 116 116 'lineno': '?', 117 117 }] 118 t = Template(TECHNICAL_500_TEMPLATE )118 t = Template(TECHNICAL_500_TEMPLATE, name='Technical 500 Template') 119 119 c = Context({ 120 120 'exception_type': exc_type.__name__, … … 142 142 return empty_urlconf(request) 143 143 144 t = Template(TECHNICAL_404_TEMPLATE )144 t = Template(TECHNICAL_404_TEMPLATE, name='Technical 404 Template') 145 145 c = Context({ 146 146 'root_urlconf': settings.ROOT_URLCONF, … … 155 155 def empty_urlconf(request): 156 156 "Create an empty URLconf 404 error response." 157 t = Template(EMPTY_URLCONF_TEMPLATE )157 t = Template(EMPTY_URLCONF_TEMPLATE, name='Empty URLConf Template') 158 158 c = Context({ 159 159 'project_name': settings.SETTINGS_MODULE.split('.')[0] django/branches/multiple-db-support/django/views/static.py
r3427 r3664 82 82 t = loader.get_template('static/directory_index') 83 83 except TemplateDoesNotExist: 84 t = Template(DEFAULT_DIRECTORY_INDEX_TEMPLATE )84 t = Template(DEFAULT_DIRECTORY_INDEX_TEMPLATE, name='Default Directory Index Template') 85 85 files = [] 86 86 for f in os.listdir(fullpath):
