Ticket #13958: patch_13958.diff

File patch_13958.diff, 1023 bytes (added by fredrik.kers@…, 13 years ago)
  • django/views/debug.py

     
    329329            try:
    330330                f = open(filename)
    331331                try:
    332                     source = f.readlines()
     332                    source = f.read().splitlines()
    333333                finally:
    334334                    f.close()
    335335            except (OSError, IOError):
     
    350350        lower_bound = max(0, lineno - context_lines)
    351351        upper_bound = lineno + context_lines
    352352
    353         pre_context = [line.strip('\n') for line in source[lower_bound:lineno]]
    354         context_line = source[lineno].strip('\n')
    355         post_context = [line.strip('\n') for line in source[lineno+1:upper_bound]]
     353        pre_context = source[lower_bound:lineno]
     354        context_line = source[lineno]
     355        post_context = source[lineno+1:upper_bound]
    356356
    357357        return lower_bound, pre_context, context_line, post_context
    358358
Back to Top