diff --git a/tryton/gui/main.py b/tryton/gui/main.py index 2f43219f08..ebca283ff7 100644 --- a/tryton/gui/main.py +++ b/tryton/gui/main.py @@ -1286,14 +1286,14 @@ class Main(object): rpcprogress.run() except TrytonServerError, exception: self.refresh_ssl() - if exception.args[0] == "AccessDenied": + if exception.faultCode == "AccessDenied": common.warning(_("Wrong Tryton Server Password" \ "\nPlease try again."), _('Access denied!')) self.sig_db_drop() else: common.warning(_('Database drop failed with error message:\n') - + str(exception.args[0]), _('Database drop failed!')) + + str(exception.faultCode), _('Database drop failed!')) return self.refresh_ssl() common.message(_("Database dropped successfully!")) @@ -1317,21 +1317,21 @@ class Main(object): res = rpcprogress.run() except TrytonServerError, exception: self.refresh_ssl() - if exception.args[0] == \ + if exception.faultCode == \ "Couldn't restore database with password": common.warning(_("It is not possible to restore a " \ "password protected database.\n" \ "Backup and restore needed to be proceed " \ "manual."), _('Database is password protected!')) - elif exception.args[0] == "AccessDenied": + elif exception.faultCode == "AccessDenied": common.warning(_("Wrong Tryton Server Password.\n" \ "Please try again."), _('Access denied!')) self.sig_db_restore() else: common.warning(_('Database restore failed with ' \ - 'error message:\n') + str(exception.args[0]), \ + 'error message:\n') + str(exception.faultCode), \ _('Database restore failed!')) return self.refresh_ssl() @@ -1357,19 +1357,19 @@ class Main(object): try: dump = rpcprogress.run() except TrytonServerError, exception: - if exception.args[0] == "Couldn't dump database with password": + if exception.faultCode == "Couldn't dump database with password": common.warning(_("It is not possible to dump a password " \ "protected Database.\nBackup and restore " \ "needed to be proceed manual."), _('Database is password protected!')) - elif exception.args[0] == "AccessDenied": + elif exception.faultCode == "AccessDenied": common.warning(_("Wrong Tryton Server Password.\n" \ "Please try again."), _('Access denied!')) self.sig_db_dump() else: common.warning(_('Database dump failed with ' \ - 'error message:\n') + str(exception.args[0]), + 'error message:\n') + str(exception.faultCode), _('Database dump failed!')) rpc.logout() Main.get_main().refresh_ssl() diff --git a/tryton/gui/window/dbcreate.py b/tryton/gui/window/dbcreate.py index 9adde3bac0..a52384594e 100644 --- a/tryton/gui/window/dbcreate.py +++ b/tryton/gui/window/dbcreate.py @@ -371,7 +371,7 @@ class DBCreate(object): langreal, admin_passwd.get_text())) rpcprogress.run() except TrytonServerError, exception: - if str(exception.args[0]) == "AccessDenied": + if str(exception.faultCode) == "AccessDenied": common.warning(_("Sorry, wrong password for " \ "the Tryton server. Please try again."), _("Access denied!")) @@ -385,7 +385,8 @@ class DBCreate(object): "be broken. Maybe drop this database! " \ "Please check the error message for " \ "possible informations.\n" \ - "Error message:\n") + str(exception.args[0]), + "Error message:\n") + + str(exception.faultCode), _("Error creating database!")) parent.present() self.dialog.destroy() diff --git a/tryton/gui/window/win_export.py b/tryton/gui/window/win_export.py index 099b38c973..94499aa958 100644 --- a/tryton/gui/window/win_export.py +++ b/tryton/gui/window/win_export.py @@ -432,7 +432,7 @@ class WinExport(object): return True except IOError, exception: common.warning(_("Operation failed!\nError message:\n%s") \ - % (exception.args[0],), _('Error')) + % (exception.faultCode,), _('Error')) return False def datas_read(self, ids, model, fields, context=None): diff --git a/tryton/rpc.py b/tryton/rpc.py index ae69b4e60a..442d6fa991 100644 --- a/tryton/rpc.py +++ b/tryton/rpc.py @@ -38,7 +38,7 @@ def db_list(host, port): logging.getLogger('rpc.result').debug(repr(result)) return result except Fault, exception: - if exception.args[0] == 'AccessDenied': + if exception.faultCode == 'AccessDenied': raise else: logging.getLogger('rpc.result').debug(repr(None))