Keep traceback as str as we don't know the encoding

issue2302
review225001
This commit is contained in:
Cédric Krier committed 2012-01-17 13:54:08 +01:00
1 parent 4bd45954fb
commit 54e3189fb6
7 files changed
+12 -31

No files matched your search

+2 -3
View File
@@ -983,8 +983,7 @@ def post_import(pool, module, to_delete):
cursor.commit()
except Exception:
cursor.rollback()
tb_s = reduce(lambda x, y: x + y,
traceback.format_exception(*sys.exc_info()))
tb_s = ''.join(traceback.format_exception(*sys.exc_info()))
logging.getLogger("convert").error(
'Could not delete id: %d of model %s\n'
'There should be some relation '
@@ -992,7 +991,7 @@ def post_import(pool, module, to_delete):
'You should manually fix this '
'and restart --update=module\n'
'Exception: %s' %
(db_id, model, tb_s.decode('utf-8', 'ignore')))
(db_id, model, tb_s))
transition_obj = pool.get('workflow.transition')
for mdata_id, db_id in transition_delete:
+1 -2
View File
@@ -104,8 +104,7 @@ class Cron(ModelSQL, ModelView):
return _INTERVALTYPES[cron.interval_type](cron.interval_number)
def _get_request_values(self, cron):
tb_s = reduce(lambda x, y: x + y,
traceback.format_exception(*sys.exc_info()))
tb_s = ''.join(traceback.format_exception(*sys.exc_info()))
tb_s = tb_s.decode('utf-8', 'ignore')
name = self.raise_user_error('request_title',
raise_exception=False)
+1 -2
View File
@@ -857,8 +857,7 @@ class ModelStorage(Model):
logger.error(exp)
# XXX should raise Exception
Transaction().cursor.rollback()
tb_s = reduce(lambda x, y: x + y,
traceback.format_exception(*sys.exc_info()))
tb_s = ''.join(traceback.format_exception(*sys.exc_info()))
warning = '%s\n%s' % (tb_s, warning)
return (-1, res, exp, warning)
done += 1
+4 -7
View File
@@ -165,13 +165,12 @@ def dispatch(host, port, protocol, database_name, user, session, object_type,
if CONFIG['verbose'] and not isinstance(exception, (
NotLogged, ConcurrencyException, UserError,
UserWarning)):
tb_s = reduce(lambda x, y: x + y,
traceback.format_exception(*sys.exc_info()))
tb_s = ''.join(traceback.format_exception(*sys.exc_info()))
logger = logging.getLogger('dispatcher')
logger.error('Exception calling method %s on ' \
'%s %s from %s@%s:%d/%s:\n' % \
(method, object_type, object_name, user, host, port,
database_name) + tb_s.decode('utf-8', 'ignore'))
database_name) + tb_s)
transaction.cursor.rollback()
raise
if not (object_name == 'res.request' and method == 'request_get'):
@@ -240,8 +239,7 @@ def create(database_name, password, lang, admin_password):
res = True
except Exception:
logger.error('CREATE DB: %s failed' % (database_name,))
tb_s = reduce(lambda x, y: x+y,
traceback.format_exception(*sys.exc_info()))
tb_s = ''.join(traceback.format_exception(*sys.exc_info()))
logger.error('Exception in call: \n' + tb_s)
raise
else:
@@ -263,8 +261,7 @@ def drop(database_name, password):
cursor.commit()
except Exception:
logger.error('DROP DB: %s failed' % (database_name,))
tb_s = reduce(lambda x, y: x+y,
traceback.format_exception(*sys.exc_info()))
tb_s = ''.join(traceback.format_exception(*sys.exc_info()))
logger.error('Exception in call: \n' + tb_s)
raise
else:
+1 -7
View File
@@ -113,13 +113,7 @@ class SimpleJSONRPCDispatcher(SimpleXMLRPCServer.SimpleXMLRPCDispatcher):
ConcurrencyException), exception:
response['error'] = exception.args
except Exception:
tb_s = ''
for line in traceback.format_exception(*sys.exc_info()):
try:
line = line.encode('utf-8', 'ignore')
except Exception:
continue
tb_s += line
tb_s = ''.join(traceback.format_exception(*sys.exc_info()))
for path in sys.path:
tb_s = tb_s.replace(path, '')
if CONFIG['debug_mode']:
+2 -3
View File
@@ -139,10 +139,9 @@ class TrytonDAVInterface(iface.dav_interface):
if CONFIG['verbose'] and not isinstance(exception, (
NotLogged, ConcurrencyException, UserError, UserWarning,
DAV_Error, DAV_NotFound, DAV_Secret, DAV_Forbidden)):
tb_s = reduce(lambda x, y: x + y,
traceback.format_exception(*sys.exc_info()))
tb_s = ''.join(traceback.format_exception(*sys.exc_info()))
logger = logging.getLogger('webdav')
logger.error('Exception:\n' + tb_s.decode('utf-8', 'ignore'))
logger.error('Exception:\n' + tb_s)
@staticmethod
def get_dburi(uri):
+1 -7
View File
@@ -113,13 +113,7 @@ class GenericXMLRPCRequestHandler:
raise xmlrpclib.Fault(exception.code,
'\n'.join((error,) + description))
except Exception:
tb_s = ''
for line in traceback.format_exception(*sys.exc_info()):
try:
line = line.encode('utf-8', 'ignore')
except Exception:
continue
tb_s += line
tb_s = ''.join(traceback.format_exception(*sys.exc_info()))
for path in sys.path:
tb_s = tb_s.replace(path, '')
if CONFIG['debug_mode']: