Opened 17 years ago
Closed 17 years ago
#6359 closed (fixed)
_get_lines_from_file() assumes loader.get_source() always exists
Reported by: | Owned by: | nobody | |
---|---|---|---|
Component: | Uncategorized | Version: | dev |
Severity: | Keywords: | ||
Cc: | Triage Stage: | Ready for checkin | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
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.
Attachments (1)
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