Ticket #6932: patch.diff
| File patch.diff, 1.9 KB (added by trac-ja@…, 4 years ago) |
|---|
-
trac/web/main.py
464 464 lineno = tb.tb_lineno - 1 465 465 before, line, after = get_lines_from_file(filename, 466 466 lineno, 5) 467 frames += [{'traceback': tb, 'filename': filename, 467 frames += [{'traceback': tb, 468 'filename': to_unicode(filename), 468 469 'lineno': lineno, 'line': line, 469 470 'lines_before': before, 'lines_after': after, 470 471 'function': tb.tb_frame.f_code.co_name, -
trac/util/__init__.py
141 141 `lineno` from the file identified by `filename`. 142 142 143 143 Returns a `(lines_before, line, lines_after)` tuple. 144 `lines_before`, `line` and `lines_after` are returned by using to_unicode() 144 145 """ 145 146 if os.path.isfile(filename): 146 147 fileobj = open(filename, 'U') … … 149 150 lbound = max(0, lineno - context) 150 151 ubound = lineno + 1 + context 151 152 152 before = [l.rstrip('\n') for l in lines[lbound:lineno]] 153 line = lines[lineno].rstrip('\n') 154 after = [l.rstrip('\n') for l in lines[lineno + 1:ubound]] 153 before = [to_unicode(l.rstrip('\n')) for l in lines[lbound:lineno]] 154 line = to_unicode(lines[lineno].rstrip('\n')) 155 after = [to_unicode(l.rstrip('\n')) \ 156 for l in lines[lineno + 1:ubound]] 155 157 156 158 return before, line, after 157 159 finally:
