uilib.py
branchstable
changeset 6683 68cfebd3b9f3
parent 6491 ee9a10b6620e
child 6685 eeedb3575d25
equal deleted inserted replaced
6682:bdf9424b499c 6683:68cfebd3b9f3
   339     return res
   339     return res
   340 
   340 
   341 # traceback formatting ########################################################
   341 # traceback formatting ########################################################
   342 
   342 
   343 import traceback
   343 import traceback
       
   344 
       
   345 def exc_message(ex, encoding):
       
   346     try:
       
   347         return unicode(ex)
       
   348     except:
       
   349         try:
       
   350             return unicode(str(ex), encoding, 'replace')
       
   351         except:
       
   352             return unicode(repr(ex), encoding, 'replace')
       
   353 
   344 
   354 
   345 def rest_traceback(info, exception):
   355 def rest_traceback(info, exception):
   346     """return a ReST formated traceback"""
   356     """return a ReST formated traceback"""
   347     res = [u'Traceback\n---------\n::\n']
   357     res = [u'Traceback\n---------\n::\n']
   348     for stackentry in traceback.extract_tb(info[2]):
   358     for stackentry in traceback.extract_tb(info[2]):