Ticket #12787: 12787.diff
File 12787.diff, 5.0 KB (added by , 15 years ago) |
---|
-
django/template/loaders/cached.py
37 37 if template_name not in self.template_cache: 38 38 template, origin = self.find_template(template_name, template_dirs) 39 39 if not hasattr(template, 'render'): 40 template = get_template_from_string(template, origin, template_name) 40 try: 41 template = get_template_from_string(template, origin, template_name) 42 except TemplateDoesNotExist: 43 return template, origin 41 44 self.template_cache[template_name] = template 42 45 return self.template_cache[template_name], None 43 46 -
django/template/loader_tags.py
97 97 raise TemplateSyntaxError(error_msg) 98 98 if hasattr(parent, 'render'): 99 99 return parent # parent is a Template object 100 try: 101 return get_template(parent) 102 except TemplateDoesNotExist: 103 raise TemplateSyntaxError("Template %r cannot be extended, because it doesn't exist" % parent) 100 return get_template(parent) 104 101 105 102 def render(self, context): 106 103 compiled_parent = self.get_parent(context) -
django/template/loader.py
44 44 def load_template(self, template_name, template_dirs=None): 45 45 source, display_name = self.load_template_source(template_name, template_dirs) 46 46 origin = make_origin(display_name, self.load_template_source, template_name, template_dirs) 47 template = get_template_from_string(source, origin, template_name) 48 return template, None 47 try: 48 template = get_template_from_string(source, origin, template_name) 49 return template, None 50 except TemplateDoesNotExist: 51 return source, display_name 49 52 50 53 def load_template_source(self, template_name, template_dirs=None): 51 54 """ -
tests/regressiontests/views/tests/debug.py
49 49 "Failed to find 'raise BrokenException' in last frame of traceback, instead found: %s" % 50 50 raising_loc) 51 51 52 def test_extends_error(self): 53 try: 54 self.client.get(reverse('test_extends')) 55 except TemplateSyntaxError, e: 56 self.assertEquals(e.args[0], "Caught TemplateDoesNotExist while rendering: missing.html") 57 58 -
tests/regressiontests/views/views.py
57 57 return render_to_response('debug/template_exception.html', 58 58 {'arg': except_args[int(n)]}) 59 59 60 def test_extends(request): 61 return render_to_response('debug/test_extends_error.html') 62 63 -
tests/regressiontests/views/urls.py
110 110 urlpatterns += patterns('regressiontests.views.views', 111 111 url(r'view_exception/(?P<n>\d+)/$', 'view_exception', name='view_exception'), 112 112 url(r'template_exception/(?P<n>\d+)/$', 'template_exception', name='template_exception'), 113 url(r'test_extends_error/$', 'test_extends', name='test_extends'), 114 113 115 ) -
tests/regressiontests/views/templates/debug/test_extends_error.html
1 {% extends "debug/broken_base.html" %} -
tests/regressiontests/views/templates/debug/broken_base.html
Property changes on: tests/regressiontests/views/templates/debug/test_extends_error.html ___________________________________________________________________ Added: svn:eol-style + native
1 {% include "missing.html" %}