X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=sfa%2Fserver%2Fxmlrpcapi.py;h=167ac88054e490c24a0fe8403cf7104756ffc303;hb=a0ef6e7c91c3c8fa376943d28fec8c5c204a78cd;hp=f182ee0b9db81f71b901398eb1b98e04c36ba898;hpb=2f1f135574b837d17507d69b901a72e1fcdcdce6;p=sfa.git diff --git a/sfa/server/xmlrpcapi.py b/sfa/server/xmlrpcapi.py index f182ee0b..167ac880 100644 --- a/sfa/server/xmlrpcapi.py +++ b/sfa/server/xmlrpcapi.py @@ -71,7 +71,7 @@ def xmlrpclib_dump(self, value, write): if isinstance(value, Type): f(*args) return - raise TypeError, "cannot marshal %s objects" % type(value) + raise TypeError("cannot marshal %s objects" % type(value)) else: f(*args) @@ -102,7 +102,7 @@ class XmlrpcApi: """ # Look up method if method not in self.methods: - raise SfaInvalidAPIMethod, method + raise SfaInvalidAPIMethod(method) # Get new instance of method try: @@ -111,7 +111,8 @@ class XmlrpcApi: callablemethod = getattr(module, classname)(self) return getattr(module, classname)(self) except (ImportError, AttributeError): - raise SfaInvalidAPIMethod, method + self.logger.log_exc("Error importing method: %s" % method) + raise SfaInvalidAPIMethod(method) def call(self, source, method, *args): """ @@ -137,7 +138,7 @@ class XmlrpcApi: method = method_map[method] methodresponse = True - except Exception, e: + except Exception as e: if SOAPpy is not None: self.protocol = 'soap' interface = SOAPpy @@ -150,10 +151,10 @@ class XmlrpcApi: try: result = self.call(source, method, *args) - except SfaFault, fault: + except SfaFault as fault: result = fault self.logger.log_exc("XmlrpcApi.handle has caught Exception") - except Exception, fault: + except Exception as fault: self.logger.log_exc("XmlrpcApi.handle has caught Exception") result = SfaAPIError(fault)