summaryrefslogtreecommitdiffstats
path: root/simple-server.py
diff options
context:
space:
mode:
authorJason Gerard DeRose <jderose@redhat.com>2008-10-02 19:42:06 -0600
committerJason Gerard DeRose <jderose@redhat.com>2008-10-02 19:42:06 -0600
commit3ffbaac64cc3a9ab704c707112f59e041986576c (patch)
treee113753d2d822d813f082f78718515c517234960 /simple-server.py
parentd84e27f0d41aa13cfa5dd154ee476bd7c5e8b072 (diff)
downloadfreeipa.git-3ffbaac64cc3a9ab704c707112f59e041986576c.tar.gz
freeipa.git-3ffbaac64cc3a9ab704c707112f59e041986576c.tar.xz
freeipa.git-3ffbaac64cc3a9ab704c707112f59e041986576c.zip
Backend.xmlrpc and simple-server.py now use the xmlrpc_marshal() and xmlrpc_unmarshal() functions respectively
Diffstat (limited to 'simple-server.py')
-rwxr-xr-xsimple-server.py13
1 files changed, 6 insertions, 7 deletions
diff --git a/simple-server.py b/simple-server.py
index e0ff4f16..2f0d9226 100755
--- a/simple-server.py
+++ b/simple-server.py
@@ -26,9 +26,11 @@ The server will run at http://localhost:8080
"""
from SimpleXMLRPCServer import SimpleXMLRPCServer
+from ipalib.util import xmlrpc_unmarshal
from ipalib import api
from ipalib import load_plugins
+api.env.server_context = True
api.finalize()
class Dispatch(object):
@@ -36,15 +38,12 @@ class Dispatch(object):
self.__cmd = cmd
def __call__(self, *params):
- if len(params) > 0:
- kw = params[0]
- else:
- kw = {}
- args = params[1:]
- return cmd(*args, **kw)
+ print 'dispatch: %s%r' % (self.__cmd.name, params)
+ (args, kw) = xmlrpc_unmarshal(*params)
+ return self.__cmd(*args, **kw)
-server = SimpleXMLRPCServer(('localhost', 8080))
+server = SimpleXMLRPCServer(('localhost', 8080), allow_none=True)
server.register_introspection_functions()
for cmd in api.Command():
server.register_function(Dispatch(cmd), cmd.name)