uilib.py
branchstable
changeset 7815 2a164a9cf81c
parent 7662 3217298823c1
child 7879 9aae456abab5
equal deleted inserted replaced
7814:1ec9fe1dfba9 7815:2a164a9cf81c
   404 import traceback
   404 import traceback
   405 
   405 
   406 def exc_message(ex, encoding):
   406 def exc_message(ex, encoding):
   407     try:
   407     try:
   408         return unicode(ex)
   408         return unicode(ex)
   409     except:
   409     except Exception:
   410         try:
   410         try:
   411             return unicode(str(ex), encoding, 'replace')
   411             return unicode(str(ex), encoding, 'replace')
   412         except:
   412         except Exception:
   413             return unicode(repr(ex), encoding, 'replace')
   413             return unicode(repr(ex), encoding, 'replace')
   414 
   414 
   415 
   415 
   416 def rest_traceback(info, exception):
   416 def rest_traceback(info, exception):
   417     """return a ReST formated traceback"""
   417     """return a ReST formated traceback"""
   421         if stackentry[3]:
   421         if stackentry[3]:
   422             res.append(u'\t  %s' % stackentry[3].decode('utf-8', 'replace'))
   422             res.append(u'\t  %s' % stackentry[3].decode('utf-8', 'replace'))
   423     res.append(u'\n')
   423     res.append(u'\n')
   424     try:
   424     try:
   425         res.append(u'\t Error: %s\n' % exception)
   425         res.append(u'\t Error: %s\n' % exception)
   426     except:
   426     except Exception:
   427         pass
   427         pass
   428     return u'\n'.join(res)
   428     return u'\n'.join(res)
   429 
   429 
   430 
   430 
   431 def html_traceback(info, exception, title='',
   431 def html_traceback(info, exception, title='',