Ticket #4250: allow-lists-for-templates.2.patch
File allow-lists-for-templates.2.patch, 1.8 KB (added by , 18 years ago) |
---|
-
C:/Python24/Lib/site-packages/django/views/generic/list_detail.py
117 117 template_name_list = [getattr(obj, template_name_field), template_name] 118 118 t = template_loader.select_template(template_name_list) 119 119 else: 120 t = template_loader. get_template(template_name)120 t = template_loader.select_template(template_name) 121 121 c = RequestContext(request, { 122 122 template_object_name: obj, 123 123 }, context_processors) -
C:/Python24/Lib/site-packages/django/template/loader.py
109 109 "Given a list of template names, returns the first that can be loaded." 110 110 for template_name in template_name_list: 111 111 try: 112 return get_template(template_name) 112 if len(template_name) == 1: #this can't be a complete template path, it must be a plain string 113 return get_template(template_name_list) 114 else: 115 return get_template(template_name) 113 116 except TemplateDoesNotExist: 114 117 continue 115 118 # If we get here, none of the templates could be loaded 116 raise TemplateDoesNotExist, ', '.join(template_name_list) 119 if len(template_name_list[0]) == 1: 120 raise TemplateDoesNotExist, template_name_list 121 else: 122 raise TemplateDoesNotExist, ', '.join(template_name_list) 117 123 118 124 add_to_builtins('django.template.loader_tags')