Reviewers: ,


Please review this at http://codereview.tryton.org/95001/

Affected files:
  M tryton/common/common.py
  M tryton/jsonrpc.py


Index: tryton/common/common.py
===================================================================
--- a/tryton/common/common.py
+++ b/tryton/common/common.py
@@ -983,14 +983,12 @@
                 return False
     elif isinstance(exception, TrytonServerError):
         if exception.faultCode == 'UserWarning':
-            msg = ''
-            if len(exception.args) > 4:
-                msg = exception.args[3]
-            res = userwarning(str(msg), str(exception.args[2]))
+            name, message, description = exception.args
+            res = userwarning(description, message)
             if res in ('always', 'ok'):
                 args2 = ('model', 'res.user.warning', 'create', {
                         'user': rpc._USER,
-                        'name': exception.args[1],
+                        'name': name,
                         'always': (res == 'always'),
                         }, rpc.CONTEXT)
                 try:
@@ -1005,10 +1003,8 @@
                 return True
             return False
         elif exception.faultCode == 'UserError':
-            msg = ''
-            if len(exception.args) > 3:
-                msg = exception.args[2]
-            warning(str(msg), str(exception.args[1]))
+            message, description = exception.args
+            warning(description, message)
             return False
         elif exception.faultCode == 'ConcurrencyException':
             if len(args) >= 6:
Index: tryton/jsonrpc.py
===================================================================
--- a/tryton/jsonrpc.py
+++ b/tryton/jsonrpc.py
@@ -21,7 +21,10 @@


 class Fault(xmlrpclib.Fault):
-    pass
+
+    def __init__(self, faultCode, faultString='', **extra):
+        super(Fault, self).__init__(faultCode, str(faultString), **extra)
+        self.args = faultString


 class ProtocolError(xmlrpclib.ProtocolError):


--
[email protected] mailing list

Reply via email to