/usr/lib/python2.7/dist-packages/catcher/formatters/text.py is in python-catcher 0.1.7+git20140530-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | from datetime import datetime
class TextFormatter:
def __format_frame(self, frame):
lines, current_line = frame.code
code = ''.join(
' ' +
('>>' if lines.index(line) == frame.line - current_line else ' ') +
' ' + line
for line in lines
)
return """
%(file)s:%(line)s
%(code)s
""" % {
'file': frame.file,
'line': frame.line,
'code': code,
}
def format(self, report):
traceback = '\n'.join(self.__format_frame(frame) for frame in report.traceback)
return """
Error report at %(timestamp)s
Traceback:
%(traceback)s
""" % {
'timestamp': datetime.fromtimestamp(int(report.timestamp)),
'traceback': traceback,
}
|