SimpleXMLRPCServer and creating a new object on for each new client request.

Piet van Oostrum piet at cs.uu.nl
Thu May 7 16:43:26 EDT 2009


>>>>> Jelle Smet <jelle at smetj.net> (JS) wrote:

>JS> Hi list,
>JS> My goals is to have concurrent and separated client sessions using xmlrpc.
>JS> Initially my though was that SimpleXMLRPCServer was able to create a new
>JS> object instance for each incoming request.

>JS> But this doesn't appear to be the case, unless I'm overlooking something,
>JS> if so please point me out.

You create a single instance of your class and then register that. There
is nothing in your code that makes the server believe it should create a
new instance for each request. 

And then of course this instance always returns the same random number.
It could generate a new random number for each call as follows:
       def show_random(self):
                return random.randrange(0,100000)
but I guess this is not what you want.

Otherwise you would have to register a function that creates a new
instance on every call.
But as Martin P. Hellwig has noted, it wouldn't give you sessions anyway.

-- 
Piet van Oostrum <piet at cs.uu.nl>
URL: http://pietvanoostrum.com [PGP 8DAE142BE17999C4]
Private email: piet at vanoostrum.org



More information about the Python-list mailing list