changeset 2126:8b7d6d70fc95

Fix reporting of faults in xmlrpc multicall code. It was trying to catch a Fault exception, but they are being passed as return values in this code. This resulted in wrongly formatted responses.
author Karol 'grzywacz' Nowak <grzywacz@sul.uni.lodz.pl>
date Fri, 15 Jun 2007 21:53:58 +0200
parents 9d5f4ba23a54
children 42232c6ac004
files MoinMoin/xmlrpc/__init__.py
diffstat 1 files changed, 10 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/xmlrpc/__init__.py	Fri Jun 15 17:36:00 2007 +0200
+++ b/MoinMoin/xmlrpc/__init__.py	Fri Jun 15 21:53:58 2007 +0200
@@ -201,17 +201,21 @@
             try:
                 # XXX A marshalling error in any response will fail the entire
                 # multicall. If someone cares they should fix this.
-                results.append([self.dispatch(method_name, params)])
-            except xmlrpclib.Fault, fault:
-                results.append(
-                    {'faultCode': fault.faultCode,
-                     'faultString': fault.faultString}
-                    )
+                result = self.dispatch(method_name, params)
+                
+                if not isinstance(result, xmlrpclib.Fault):
+                    results.append([result])
+                else:
+                    results.append(
+                        {'faultCode': result.faultCode,
+                         'faultString': result.faultString}
+                        )
             except:
                 results.append(
                     {'faultCode': 1,
                      'faultString': "%s:%s" % (sys.exc_type, sys.exc_value)}
                     )
+                
         return results
 
     #############################################################################