summaryrefslogtreecommitdiffstats
path: root/ipaserver
diff options
context:
space:
mode:
authorJason Gerard DeRose <jderose@redhat.com>2009-01-23 16:16:00 -0700
committerRob Crittenden <rcritten@redhat.com>2009-02-03 15:29:03 -0500
commit0a3ae60038c7b672d83f24678e2d791b3cad443e (patch)
tree8e232b8e4759c3ac0c106e37b51fb576354bcbe4 /ipaserver
parent0cfb0e191ad878d1b22e98ce484bf3048f7138c2 (diff)
downloadfreeipa-0a3ae60038c7b672d83f24678e2d791b3cad443e.tar.gz
freeipa-0a3ae60038c7b672d83f24678e2d791b3cad443e.tar.xz
freeipa-0a3ae60038c7b672d83f24678e2d791b3cad443e.zip
Ported xmlserver to subclass from Executioner
Diffstat (limited to 'ipaserver')
-rw-r--r--ipaserver/rpcserver.py30
1 files changed, 8 insertions, 22 deletions
diff --git a/ipaserver/rpcserver.py b/ipaserver/rpcserver.py
index 8c04158a8..9616e481d 100644
--- a/ipaserver/rpcserver.py
+++ b/ipaserver/rpcserver.py
@@ -24,7 +24,7 @@ Also see the `ipalib.rpc` module.
"""
from xmlrpclib import Fault
-from ipalib import Backend
+from ipalib.backend import Executioner
from ipalib.errors2 import PublicError, InternalError, CommandError
from ipalib.rpc import xml_dumps, xml_loads
from ipalib.util import make_repr
@@ -39,36 +39,22 @@ def params_2_args_options(params):
return (params, dict())
-class xmlserver(Backend):
+class xmlserver(Executioner):
"""
Execution backend plugin for XML-RPC server.
Also see the `ipalib.rpc.xmlclient` plugin.
"""
- def dispatch(self, method, params):
- self.debug('Received RPC call to %r', method)
- if method not in self.Command:
- raise CommandError(name=method)
- (args, options) = params_2_args_options(params)
- result = self.Command[method](*args, **options)
- return (result,) # Must wrap XML-RPC response in a tuple singleton
-
- def execute(self, data):
+ def marshaled_dispatch(self, data):
"""
Execute the XML-RPC request in contained in ``data``.
"""
try:
- (params, method) = xml_loads(data)
- response = self.dispatch(method, params)
- print 'okay'
- except Exception, e:
- if not isinstance(e, PublicError):
- self.exception(
- '%s: %s', e.__class__.__name__, str(e)
- )
- e = InternalError()
- assert isinstance(e, PublicError)
- self.info('%s: %s', e.__class__.__name__, str(e))
+ (params, name) = xml_loads(data)
+ (args, options) = params_2_args_options(params)
+ response = (self.execute(name, *args, **options),)
+ except PublicError, e:
+ self.info('response: %s: %s', e.__class__.__name__, str(e))
response = Fault(e.errno, e.strerror)
return xml_dumps(response, methodresponse=True)