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
This commit is contained in:
Malcolm Tredinnick 2008-02-03 02:11:58 +00:00
parent 2542b94fb2
commit 8ce7d4740e
1 changed files with 5 additions and 3 deletions

View File

@ -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). Returns (pre_context_lineno, pre_context, context_line, post_context).
""" """
source = None source = None
if loader is not None: if loader is not None and hasattr(loader, "get_source"):
source = loader.get_source(module_name).splitlines() source = loader.get_source(module_name)
else: if source is not None:
source = source.splitlines()
if source is None:
try: try:
f = open(filename) f = open(filename)
try: try: