Dirk Meyer wrote:
> "Duncan Webb" wrote:
>> The only thing that I've not researched yet is how to replace the reactor
>> loop, subclassing SimpleXMLRPCServer may be the solution for this.
>
> Maybe use kaa.notifier as basic framework. Doing this would make the
> code compatible with 2.0. We only need to feed xmlrpc into
> kaa.notifier and we are done.

If you only need the server:

| import kaa.notifier
| from SimpleXMLRPCServer import SimpleXMLRPCServer
| 
| class XMLRPCServer(SimpleXMLRPCServer):
| 
|     allow_reuse_address = True
|     
|     def register_function(self, function, name = None):
|         if not name:
|             name = function.__name__
|         c = kaa.notifier.MainThreadCallback(function)
|         c.set_async(False)
|         SimpleXMLRPCServer.register_function(self, c, name)
| 
|     def _handle_request(self):
|         kaa.notifier.Thread(self.handle_request).start()
|     
|     def serve_forever(self):
|         
kaa.notifier.WeakSocketDispatcher(self._handle_request).register(self.fileno())
|         kaa.signals['shutdown'].connect_weak(self.server_close)

That should be it. It's a bad hack to use threads to avoid the
mainloop blocking. Well, it works.

Use register_function and serve_forever as described in
http://docs.python.org/lib/simple-xmlrpc-servers.html
and start the mainloop with kaa.notifier.loop()


Dischi

-- 
One Page Principle:
        A specification that will not fit on one page of 8.5x11 inch
        paper cannot be understood.
                -- Mark Ardis

Attachment: pgpGaS90fZuCy.pgp
Description: PGP signature

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Freevo-users mailing list
Freevo-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/freevo-users

Reply via email to