"""Print traceback in HTML. :copyright: 2000-2008 LOGILAB S.A. (Paris, FRANCE), all rights reserved. :contact: http://www.logilab.fr/ -- mailto:contact@logilab.fr :license: General Public License version 2 - http://www.gnu.org/licenses """ __docformat__ = "restructuredtext en" from warnings import warn warn('html module is deprecated and will disappear in a near release', DeprecationWarning, stacklevel=2) import traceback from xml.sax.saxutils import escape # mk html traceback error ##################################################### def html_traceback(info, exception, title='', encoding='ISO-8859-1', body=''): """Return an html formatted traceback from python exception infos. """ #typ, value, tbck = info stacktb = traceback.extract_tb(info[2]) #tbck) strings = [] if body: strings.append('
') strings.append(body) strings.append('
') if title: strings.append('

%s

'% escape(title)) strings.append('

%s

' % escape(str(exception))) strings.append('
') for stackentry in stacktb : strings.append('File %s, line ' '%s, function ' '%s:
'%( escape(stackentry[0]), stackentry[1], stackentry[2])) if stackentry[3]: string = escape(repr(stackentry[3])[1:-1])#.encode(encoding) strings.append('  %s
\n' % string) strings.append('
') return '\n'.join(strings)