Opened 9 years ago
Closed 9 years ago
#26109 closed Cleanup/optimization (fixed)
loader.select_template() raises a confusing message if passed a string containing a period
Reported by: | Ahmed Mohamed | Owned by: | nobody |
---|---|---|---|
Component: | Template system | Version: | 1.9 |
Severity: | Normal | Keywords: | template loader |
Cc: | Triage Stage: | Accepted | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
Currently supplying a string to select_template
raise an IOError
, which is not meaningful. Here's a sample.
IOError at XXX
[Errno 21] Is a directory: u'xxx/site-packages/django/contrib/admin/templates'
It's better to check if template_name_list
is actually a list (Iterable
). If it is a string, we can either
- Raise a TypeError and suggest to use
get_template
function instead. - Pass the string to
get_template
silently.
I am creating a pull request going with the first option. Happy to change it if necessary.
Change History (4)
comment:1 by , 9 years ago
Easy pickings: | unset |
---|---|
Has patch: | set |
Needs tests: | set |
Summary: | Extra parameter check for loader.select_tamplate [Check if a string is passed]. → loader.select_tamplate() raises a confusing message if passed a string containing a period |
Triage Stage: | Unreviewed → Accepted |
Type: | Bug → Cleanup/optimization |
comment:2 by , 9 years ago
Summary: | loader.select_tamplate() raises a confusing message if passed a string containing a period → loader.select_template() raises a confusing message if passed a string containing a period |
---|
comment:3 by , 9 years ago
Needs tests: | unset |
---|
Note:
See TracTickets
for help on using tickets.
PR (needs tests)