summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMalcolm Tredinnick <malcolm.tredinnick@gmail.com>2008-02-03 02:11:58 +0000
committerMalcolm Tredinnick <malcolm.tredinnick@gmail.com>2008-02-03 02:11:58 +0000
commit8ce7d4740e88fe38a290aa12257204065393b5ba (patch)
tree02e5a64294405d9b57d3bcdd3105ced74ebf64b6
parent2542b94fb214847af0a4e1eca84558debbf32ee2 (diff)
Fixed #6359 -- Fixed an oversight in the debug output: template loaders need not have a get_source() method. Thanks, Guido van Rossum.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@7063 bcc190cf-cafb-0310-a4f2-bffc1f526a37
-rw-r--r--django/views/debug.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/django/views/debug.py b/django/views/debug.py
index 5f6f17d016..7322682e89 100644
--- a/django/views/debug.py
+++ b/django/views/debug.py
@@ -192,9 +192,11 @@ def _get_lines_from_file(filename, lineno, context_lines, loader=None, module_na
Returns (pre_context_lineno, pre_context, context_line, post_context).
"""
source = None
- if loader is not None:
- source = loader.get_source(module_name).splitlines()
- else:
+ if loader is not None and hasattr(loader, "get_source"):
+ source = loader.get_source(module_name)
+ if source is not None:
+ source = source.splitlines()
+ if source is None:
try:
f = open(filename)
try: