gnumed-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Gnumed-devel] xmlrpc performance


From: Horst Herb
Subject: Re: [Gnumed-devel] xmlrpc performance
Date: Fri, 28 Feb 2003 10:39:00 +1100
User-agent: Mozilla/5.0 (Windows; U; Win98; en-US; rv:1.3b) Gecko/20030210

Horst Herb wrote:

if no_xmlrpc
        import myserver

def connect():
                return xmlrpclib.Server('http://localhost:8000')
        
if no_xmlrpc:
        server = myserver.PersonDB()
else:
        server = connect()

        server.GetPerson('1')

Sorry, must have been sleeping while typing this crappy design.

Should be:

def connect(xmlrpc_host=None):
        if xmlrpc_host is not None:
                return xmlrpclib.Server(xmlrpc_host)
        else:
                import my_server_module
                return my_server_module.my_service_class()

and then, anything in the rest of the client module will be entirely transparent; no "if's" needed at all.

Any service module, if run as "__main__", should run as XMLRPC server and use sys.argv[1] as port argument If imported, it should have a function "runXMLRPCserver(port)" to start the server programmatically if needed

Of course, one would polish up connnect() a bit to implement lazy /cached connections/objects

Horst





reply via email to

[Prev in Thread] Current Thread [Next in Thread]