Opened 17 years ago
Closed 17 years ago
#6359 closed (fixed)
_get_lines_from_file() assumes loader.get_source() always exists
Description ¶
PEP 302 says that loaders may *optionally* implement get_source(). It also says that it may return None.
django/views/debug.py line 196 assumes that it always exists and never returns None.
Here's a patch that fixes this.
Change History (6)
by , 17 years ago
Attachment: | debug.diff added |
---|
comment:1 by , 17 years ago
Has patch: | set |
---|
comment:2 by , 17 years ago
Is the loader is not None
bit needed since you're adding hasattr()
?
hasattr(None, "get_source")
is False, so that seems to cover both cases on its own :)
comment:3 by , 17 years ago
True, but it does become more obscure that way IMO. Anyway, your choice.
comment:4 by , 17 years ago
Triage Stage: | Unreviewed → Ready for checkin |
---|
comment:5 by , 17 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Note:
See TracTickets
for help on using tickets.
Patch for django/views/debug.py