[FIX] netsv: don't try to post_mortem exception which don't have tracebacks (for --debug)

bzr revid: odo@openerp.com-20110617165645-zno4dj303irhndhx
This commit is contained in:
Olivier Dony 2011-06-17 18:56:45 +02:00
parent d4543d2408
commit a9bd4f2ce1
1 changed files with 2 additions and 1 deletions

View File

@ -37,6 +37,7 @@ import sys
import threading import threading
import time import time
import warnings import warnings
import types
from pprint import pformat from pprint import pformat
# TODO modules that import netsvc only for things from loglevels must be changed to use loglevels. # TODO modules that import netsvc only for things from loglevels must be changed to use loglevels.
@ -440,7 +441,7 @@ class OpenERPDispatcher:
self.log('exception', tools.exception_to_unicode(e)) self.log('exception', tools.exception_to_unicode(e))
tb = getattr(e, 'traceback', sys.exc_info()) tb = getattr(e, 'traceback', sys.exc_info())
tb_s = cgitb.text(tb) tb_s = cgitb.text(tb)
if tools.config['debug_mode']: if tools.config['debug_mode'] and isinstance(tb, types.TracebackType):
import pdb import pdb
pdb.post_mortem(tb[2]) pdb.post_mortem(tb[2])
raise OpenERPDispatcherException(e, tb_s) raise OpenERPDispatcherException(e, tb_s)