[mod_python] mod_python + dbus ?

Panard panard at backzone.net
Mon Jul 3 09:28:29 EDT 2006


Hi,

I'm tring to use a running dbus service with mod_python. The service runs 
fine, a python cgi script uses it fine, but a mod_python script doesn't 
respond...

Here are the scripts used :

The service itself :
======== dbus_service.py ========
import dbus
import dbus.service
import gobject

iface = 'org.inzenet.test_mp.IFace'

class test( dbus.service.Object ) :

    def __init__( self, bus_name ) :
        dbus.service.Object.__init__( self, bus_name, '/org/inzenet/test_mp' )

    @dbus.service.method(iface)
    def test( self ) :
        return "OK!"


bus = dbus.service.BusName('org.inzenet.test_mp', bus=dbus.SystemBus())
test( bus )

mainloop = gobject.MainLoop()
mainloop.run()
===========

DBus perms :
======
<busconfig>
        <policy user="panard">
                <allow own="org.inzenet.test_mp"/>
        </policy>
        <policy context="default">
                <allow send_destination="org.inzenet.test_mp"/>
                <allow receive_sender="org.inzenet.test_mp"/>
        </policy>
</busconfig>
========
Launch the service with
$ python dbus_service.py


The mod_python script :
===== test_dbus.pu =====
def test( req ) :
    import dbus
    bus = dbus.SystemBus()
    service = bus.get_object('org.inzenet.test_mp','/org/inzenet/test_mp')
    return service.test( dbus_interface = 'org.inzenet.test_mp.IFace' )


Calling http://localhost/~panard/mp/test_dbus.py/test doesn't respond...


Any clues?


Thanks


Panard


More information about the Mod_python mailing list