[Twisted-Python] xmlrpc protocoll instanze per connection?

Pet petshmidt at googlemail.com
Thu Aug 5 10:21:04 EDT 2010


On Thu, Aug 5, 2010 at 3:32 PM, Alan Franzoni <mailing at franzoni.eu> wrote:
> On 8/4/10 1:30 PM, Pet wrote:
>
>> AFAIU this works only if Factory is subclassing
>> protocol.ServerFactory, XMLRPCFactory subclasses server.Site, where
>> protocol attribute is not present
>
> server.Site subclasses  http.HTTPFactory which, in turns, subclasses
> protocol.ServerFactory:
>
> http://twistedmatrix.com/documents/10.0.0/api/twisted.web.server.Site.html
>
>
> by the way, if I now understand your question: just subclass XMLRPC and
> create your own xmlrpc resource class by adding methods like
>
> xmlrpc_somemethod
> xmlrpc_othermethod
>
> then add such handler to your server.Site, and you're done. Your method
> will be invoked once per request.

what I've tried to do is to have objects, which were members of
XMLRPC. And these objects would have some internal state which is
isolated per request. But each new request has changed this objects,
because xmlrpc is created once and not for each request or connection.
I've solved this by modifying render_POST where I create those objects
before calling requested function and so they lives only there without
being overwritten by new request. Ugh... It's might be ugly, but works
for me

Pet

>
> Alan Franzoni
>
>
> _______________________________________________
> Twisted-Python mailing list
> Twisted-Python at twistedmatrix.com
> http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
>



More information about the Twisted-Python mailing list