merged trunk -r 18510:18539
[sfa.git] / sfa / util / api.py
index 5c5813f..9424b49 100644 (file)
@@ -192,9 +192,12 @@ class BaseAPI:
 
         try:
             result = self.call(source, method, *args)
+        except SfaFault, fault:
+            result = fault 
         except Exception, fault:
-            traceback.print_exc(file = log)
-            result = fault
+            #traceback.print_exc(file = log)
+            result = SfaAPIError(fault)
+
 
         # Return result
         response = self.prepare_response(result, method)
@@ -206,7 +209,7 @@ class BaseAPI:
         """   
  
         if self.protocol == 'xmlrpclib':
-            if not isinstance(result, Exception):
+            if not isinstance(result, SfaFault):
                 result = (result,)
             response = xmlrpclib.dumps(result, methodresponse = True, encoding = self.encoding, allow_none = 1)
         elif self.protocol == 'soap':