From 8f7b83e8e7f06ec57dc593238b02066ffcd38e3d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Wed, 7 Jan 2009 12:41:11 +0100 Subject: [PATCH] Test exception.args before using it for issue734 --- trytond/osv/osv.py | 5 +++-- trytond/report/report.py | 5 +++-- trytond/wizard/wizard.py | 5 +++-- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/trytond/osv/osv.py b/trytond/osv/osv.py index a2c9eaaecd..6100e78975 100644 --- a/trytond/osv/osv.py +++ b/trytond/osv/osv.py @@ -46,9 +46,10 @@ class OSVService(Service): res = getattr(obj, method)(cursor, user, *args, **kargs) return res except Exception, exception: - if CONFIG['verbose'] or str(exception.args[0]) not in \ + if CONFIG['verbose'] or (exception.args \ + and str(exception.args[0]) not in \ ('NotLogged', 'ConcurrencyException', 'UserError', - 'UserWarning'): + 'UserWarning')): tb_s = reduce(lambda x, y: x+y, traceback.format_exception(*sys.exc_info())) logger = logging.getLogger("web-service") diff --git a/trytond/report/report.py b/trytond/report/report.py index 43541b80cb..7b88d72411 100644 --- a/trytond/report/report.py +++ b/trytond/report/report.py @@ -56,9 +56,10 @@ class ReportService(Service): res = report.execute(cursor, user, ids, datas, context) return res except Exception, exception: - if CONFIG['verbose'] or str(exception.args[0]) not in \ + if CONFIG['verbose'] or (exception.args \ + and str(exception.args[0]) not in \ ('NotLogged', 'ConcurrencyException', 'UserError', - 'UserWarning'): + 'UserWarning')): tb_s = reduce(lambda x, y: x+y, traceback.format_exception(*sys.exc_info())) logging.getLogger("web-service").error( diff --git a/trytond/wizard/wizard.py b/trytond/wizard/wizard.py index 6dee6205d7..83256b1933 100644 --- a/trytond/wizard/wizard.py +++ b/trytond/wizard/wizard.py @@ -34,9 +34,10 @@ class WizardService(Service): res = wizard.execute(cursor, user, data, state, context) return res except Exception, exception: - if CONFIG['verbose'] or str(exception.args[0]) not in \ + if CONFIG['verbose'] or (exception.args \ + and str(exception.args[0]) not in \ ('NotLogged', 'ConcurrencyException', 'UserError', - 'UserWarning'): + 'UserWarning')): tb_s = reduce(lambda x, y: x+y, traceback.format_exception(*sys.exc_info())) logging.getLogger("web-service").error(