API change for Python dbus.Service

Seth Nickell snickell at redhat.com
Sat Jul 10 20:07:53 PDT 2004


My latest commit to the python bindings requires easy (but mandatory)
modifications to any DBus services written in python. I added a
"message" argument that is passed as the first argument to all methods
shared over the bus. For example, if you had:

class SomeObject(dbus.Object):
    <snip>
    def HelloWorld(self, some_argument):
        print ("Received: " + some_argument)
        return "Hi back to you"

You must now do:

class SomeObject(dbus.Object):
    <snip>
    def HelloWorld(self, message, some_argument):
        print ("Received: " + some_argument)
        return "Hi back to you"

(notice that HelloWorld has an extra argument, message)

message is a dbus.Message and contains useful methods like
"message.get_sender()" that are important for some DBus methods to be
able to track down who sent them the message, etc.

-Seth




More information about the dbus mailing list