Handling empty list of candidates in select_template function
|Reported by:||Silver_Ghost||Owned by:||Silver_Ghost|
|Has patch:||yes||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
django.template.loader.select_template expects list of template names and select first loadable. If there are some template names in list and no one from them couldn't be loaded then raising TemplateDoesNotExist exception is the right decision. But if there isn't any template names in the list then >>Template<<DoesNotExist is wrong exception, I think.
So maybe checks if list is empty and raise exception with message like "I can't load any template for you because you didn't gave me any possible variants"?
Change History (6)
Changed 5 years ago by Silver_Ghost
comment:1 Changed 5 years ago by carljm
- Has patch set
- Needs documentation unset
- Needs tests set
- Patch needs improvement set
- Triage Stage changed from Unreviewed to Accepted