Ticket #16502: handle_empty_list_of_templates_r16549.diff

File handle_empty_list_of_templates_r16549.diff, 614 bytes (added by Silver_Ghost, 13 years ago)

Adds check for non-emptyness for list of template_names in django.template.loader.select_template.

  • django/template/loader.py

    180180def select_template(template_name_list):
    181181    "Given a list of template names, returns the first that can be loaded."
    182182    not_found = []
     183    if not template_name_list:
     184        raise ValueError("Couldn't choose template for load since there are"
     185                         " no candidates")
    183186    for template_name in template_name_list:
    184187        try:
    185188            return get_template(template_name)
Back to Top