diff options
Diffstat (limited to 'ipalib/plugins')
-rw-r--r-- | ipalib/plugins/rpcclient.py (renamed from ipalib/plugins/xmlclient.py) | 27 |
1 files changed, 24 insertions, 3 deletions
diff --git a/ipalib/plugins/xmlclient.py b/ipalib/plugins/rpcclient.py index 21ba47e2..6010b8dd 100644 --- a/ipalib/plugins/xmlclient.py +++ b/ipalib/plugins/rpcclient.py @@ -1,8 +1,9 @@ # Authors: # Jason Gerard DeRose <jderose@redhat.com> # Rob Crittenden <rcritten@redhat.com> +# Petr Viktorin <pviktori@redhat.com> # -# Copyright (C) 2008 Red Hat +# Copyright (C) 2008-2013 Red Hat # see file 'COPYING' for use and warranty information # # This program is free software; you can redistribute it and/or modify @@ -19,11 +20,31 @@ # along with this program. If not, see <http://www.gnu.org/licenses/>. """ -XML-RPC client plugin. +RPC client plugins. """ from ipalib import api if 'in_server' in api.env and api.env.in_server is False: - from ipalib.rpc import xmlclient + from ipalib.rpc import xmlclient, jsonclient api.register(xmlclient) + api.register(jsonclient) + + # FIXME: api.register only looks at the class name, so we need to create + # trivial subclasses with the desired name. + if api.env.rpc_protocol == 'xmlrpc': + + class rpcclient(xmlclient): + """xmlclient renamed to 'rpcclient'""" + pass + api.register(rpcclient) + + elif api.env.rpc_protocol == 'jsonrpc': + + class rpcclient(jsonclient): + """jsonclient renamed to 'rpcclient'""" + pass + api.register(rpcclient) + + else: + raise ValueError('unknown rpc_protocol: %s' % api.env.rpc_protocol) |