Edgewall Software

Ticket #6932: patch.diff

File patch.diff, 1.9 KB (added by trac-ja@…, 4 years ago)

patch against source:trunk@6635.

  • trac/web/main.py

     
    464464                        lineno = tb.tb_lineno - 1 
    465465                        before, line, after = get_lines_from_file(filename, 
    466466                                                                  lineno, 5) 
    467                         frames += [{'traceback': tb, 'filename': filename, 
     467                        frames += [{'traceback': tb, 
     468                                    'filename': to_unicode(filename), 
    468469                                    'lineno': lineno, 'line': line, 
    469470                                    'lines_before': before, 'lines_after': after, 
    470471                                    'function': tb.tb_frame.f_code.co_name, 
  • trac/util/__init__.py

     
    141141    `lineno` from the file identified by `filename`. 
    142142     
    143143    Returns a `(lines_before, line, lines_after)` tuple. 
     144    `lines_before`, `line` and `lines_after` are returned by using to_unicode() 
    144145    """ 
    145146    if os.path.isfile(filename): 
    146147        fileobj = open(filename, 'U') 
     
    149150            lbound = max(0, lineno - context) 
    150151            ubound = lineno + 1 + context 
    151152 
    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]] 
    155157 
    156158            return before, line, after 
    157159        finally: