Use faultCode instead of first args since jsonrpc

This commit is contained in:
Cédric Krier committed 2011-09-20 14:46:41 +02:00
1 parent 26dd5fa393
commit ba4eedb5b6
4 files changed
+13 -12

No files matched your search

+8 -8
View File
@@ -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()
+3 -2
View File
@@ -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()
+1 -1
View File
@@ -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):
+1 -1
View File
@@ -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))