Ticket #4250: allow-lists-for-templates.patch

File allow-lists-for-templates.patch, 1.5 KB (added by adamfast@…, 18 years ago)

allow lists for templates.patch

  • C:/Python24/Lib/site-packages/django/views/generic/list_detail.py

     
    117117        template_name_list = [getattr(obj, template_name_field), template_name]
    118118        t = template_loader.select_template(template_name_list)
    119119    else:
    120         t = template_loader.get_template(template_name)
     120        t = template_loader.select_template(template_name)
    121121    c = RequestContext(request, {
    122122        template_object_name: obj,
    123123    }, context_processors)
  • C:/Python24/Lib/site-packages/django/template/loader.py

     
    109109    "Given a list of template names, returns the first that can be loaded."
    110110    for template_name in template_name_list:
    111111        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)
    113116        except TemplateDoesNotExist:
    114117            continue
    115118    # If we get here, none of the templates could be loaded
Back to Top