From 8ce7d4740e88fe38a290aa12257204065393b5ba Mon Sep 17 00:00:00 2001 From: Malcolm Tredinnick Date: Sun, 3 Feb 2008 02:11:58 +0000 Subject: [PATCH] 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 --- django/views/debug.py | 8 +++++--- 1 file 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: