summaryrefslogtreecommitdiffstats
path: root/simple-server.py
diff options
context:
space:
mode:
authorJason Gerard DeRose <jderose@redhat.com>2008-10-02 17:02:24 -0600
committerJason Gerard DeRose <jderose@redhat.com>2008-10-02 17:02:24 -0600
commit6000b6b5c62181d25783b6d45adb2ed6f3928480 (patch)
treee0eb9333314636503984e4d1019ff9378d86195e /simple-server.py
parent0e137110c7f3c543faf9ec4cc7917d6aa81f02a6 (diff)
downloadfreeipa-6000b6b5c62181d25783b6d45adb2ed6f3928480.tar.gz
freeipa-6000b6b5c62181d25783b6d45adb2ed6f3928480.tar.xz
freeipa-6000b6b5c62181d25783b6d45adb2ed6f3928480.zip
Implemented basic Command.forward() method
Diffstat (limited to 'simple-server.py')
-rwxr-xr-xsimple-server.py22
1 files changed, 11 insertions, 11 deletions
diff --git a/simple-server.py b/simple-server.py
index b9de57985..02635f7dd 100755
--- a/simple-server.py
+++ b/simple-server.py
@@ -25,22 +25,22 @@ from ipalib import load_plugins
api.finalize()
+class Dispatch(object):
+ def __init__(self, cmd):
+ self.__cmd = cmd
-def test_func(*args, **kw):
- 'A test function'
- print args, kw
- return '%s, %s' % (repr(args), repr(kw))
+ def __call__(self, *params):
+ if len(params) > 0:
+ kw = params[0]
+ else:
+ kw = {}
+ args = params[1:]
+ return cmd(*args, **kw)
-def stuff(first, last):
- 'Do stuff'
- print first, last
- return first + last
server = SimpleXMLRPCServer(('localhost', 8080))
server.register_introspection_functions()
-#server.register_function(test_func)
-#server.register_function(stuff)
for cmd in api.Command():
- server.register_function(cmd, cmd.name)
+ server.register_function(Dispatch(cmd), cmd.name)
server.serve_forever()