#
-# Geniwrapper XML-RPC and SOAP interfaces
+# SFA XML-RPC and SOAP interfaces
#
-### $Id: api.py 15596 2009-10-31 21:42:05Z anil $
-### $URL: https://svn.planet-lab.org/svn/sfa/trunk/sfa/plc/api.py $
+### $Id$
+### $URL$
#
import sys
from sfa.util.debug import *
from sfa.trust.credential import *
from sfa.trust.certificate import *
-from sfa.util.misc import *
+from sfa.util.namespace import *
from sfa.util.sfalogging import *
# See "2.2 Characters" in the XML specification:
self.encoding = encoding
# flat list of method names
- methods_module = __import__(methods)
- self.methods_module = methods_module
- self.methods = methods_module.methods.all
+
+ self.methods_module = methods_module = __import__(methods, fromlist=[methods])
+ self.methods = methods_module.all
# Better just be documenting the API
if config is None:
"""
# Look up method
if method not in self.methods:
- raise GeniInvalidAPIMethod, method
+ raise SfaInvalidAPIMethod, method
# Get new instance of method
try:
classname = method.split(".")[-1]
- module = __import__(self.methods_module.methods.__name__ + "." + method, globals(), locals(), [classname])
+ module = __import__(self.methods_module.__name__ + "." + method, globals(), locals(), [classname])
callablemethod = getattr(module, classname)(self)
return getattr(module, classname)(self)
except ImportError, AttributeError:
- raise GeniInvalidAPIMethod, method
+ raise SfaInvalidAPIMethod, method
def call(self, source, method, *args):
"""
# Return result
if interface == xmlrpclib:
- if not isinstance(result, GeniFault):
+ if not isinstance(result, SfaFault):
result = (result,)
data = xmlrpclib.dumps(result, methodresponse = True, encoding = self.encoding, allow_none = 1)