changed rpcapi.py and rpcserver to support the remoteCall call schema properly (was first implemented wrong with the server having the callRemote method, which actually should be part of the xmlrpc.Proxy).

git-svn-id: svn://svn.cy55.de/Zope3/src/cybertools/trunk@2720 fd906abe-77d9-0310-91a1-e0d9ade77398
This commit is contained in:
scrat 2008-06-23 20:24:58 +00:00
parent 9a70a8b307
commit 9570ed459f
2 changed files with 81 additions and 16 deletions

View file

@ -25,9 +25,6 @@ $Id: rpcapi.py
def setup(config):
global xmlrpc
if config.transportserver.xmlrpc == 'testing':
from cybertools.agent.testing.rpcserver import RPCServer
from cybertools.agent.testing.rpcserver import RPCServer, xmlrpc
else:
try:
from twisted.web import xmlrpc
except ImportError:
from cybertools.agent.testing.rpcserver import RPCServer
from twisted.web import xmlrpc

View file

@ -22,6 +22,8 @@ Fake rpcserver for testing purposes
$Id$
"""
from twisted.internet.defer import succeed
class RPCServer(object):
serverURL = ''
@ -40,23 +42,89 @@ class RPCServer(object):
self.password = password
self.controller = controlObj
def callRemote(self, methodName, *params):
"""
intended to simulate the callRemote command of a real xmlrpcserver
that takes a method name and calls the method, returning the results
as xml formatted strings
"""
method = getattr(self, methodName)
return method(*params)
def getMetadata(self, metadata):
if self.controller is not None:
# pass metadata to controller
# this is done AFTER the resource (like e.g. file or mail)
# is handed over
pass
return "Metadata received!"
deferred = defer.succeed('Metadata accepted by server')
return deferred
def xmlrpc_shutdownRPCServer():
return "xmlrRPC server shutdown completed!"
class xmlrpc(object):
Proxy = None
XMLRPC = None
Handler = None
XMLRPCIntrospection = None
QueryProtocol = None
_QueryFactory = None
def __init__(self):
self.Proxy = Proxy()
self.XMLRPC = XMLRPC()
self.Handler = Handler()
self.XMLRPCIntrospection = XMLRPCIntrospection()
self.QueryProtocol = QueryProtocol()
self._QueryFactory = _QueryFactory()
def addIntrospection(self, xmlrpc):
pass
class Proxy(object):
url = ''
user = None
password = None
allowNone = False
queryFactory = None
def __init__(self, url, user=None, password=None, allowNone=False):
self.url = url
self.user = user
self.password = password
self.allowNone = allowNone
self.RPCServer = RPCServer()
def callRemote(self, methodName, *params):
"""
intended to simulate the callRemote command of a real xmlrpcserver
that takes a method name and calls the method, returning the results
as xml formatted strings
"""
method = getattr(self.RPCServer, methodName)
return method(*params)
class XMLRPC(object):
def __init__(self):
pass
class Handler(object):
def __init__(self):
pass
class XMLRPCIntrospection(object):
def __init__(self):
pass
class QueryProtocol(object):
def __init__(self):
pass
class _QueryFactory(object):
def __init__(self):
pass