Ticket #13958: patch_13958.2.diff

File patch_13958.2.diff, 1.0 KB (added by Riccardo Attilio Galli, 12 years ago)
  • django/views/debug.py

    diff --git django/views/debug.py django/views/debug.py
    index 3414cb1..5490d5f 100644
    class ExceptionReporter(object):  
    347347        if source is None:
    348348            try:
    349349                with open(filename, 'rb') as fp:
    350                     source = fp.readlines()
     350                    source = fp.read().splitlines()
    351351            except (OSError, IOError):
    352352                pass
    353353        if source is None:
    class ExceptionReporter(object):  
    366366        lower_bound = max(0, lineno - context_lines)
    367367        upper_bound = lineno + context_lines
    368368
    369         pre_context = [line.strip('\n') for line in source[lower_bound:lineno]]
    370         context_line = source[lineno].strip('\n')
    371         post_context = [line.strip('\n') for line in source[lineno+1:upper_bound]]
     369        pre_context = source[lower_bound:lineno]
     370        context_line = source[lineno]
     371        post_context = source[lineno+1:upper_bound]
    372372
    373373        return lower_bound, pre_context, context_line, post_context
    374374
Back to Top