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)
comment:1 Changed 6 years ago by
|Patch needs improvement:||set|
|Triage Stage:||Unreviewed → Accepted|