Dbus Object Extension/Inheritance in Python

Robert Rawlins robert_rawlins at hotmail.com
Fri Feb 15 06:41:50 PST 2008


Hi Curtis,
> Robert Rawlins wrote:> > Hello Chaps,> > > > I've got a few classes in a dbus library which I want to add additional > > functionality too and wanted to get your opinions on the best way to do > > this. Generally when working with standard Python classes I would simply > > inherit from the base class, however, I wonder if this is possible from > > a dbus object? or should I be looking at creating proxy objects or using > > a decorator pattern?> > The limitation I ran into is that the published methods are all > decorated, so you can't replace them directly on an inherited model. > I've no idea what would happen if you tried and decorated them with the > same interface.> > We work around this by making the exposed methods just call do_FOO > internally.> > --> Curtis Maloney> cmaloney at cardgate.net
Thanks for getting back to me about this. I ended up, for the moment just choosing to go for Composition over Inheritance, I appreciate that its not really a best practice in this scenario and isn't the 'proper' way to achieve it but it works for me.
 
I now just create an instance of the dbus object in my class init proceedure and have a getRealObject() method which returns the composed dbus object for any calls I need to make on the bus.
 
Cheers Curtis.
 
Robert
_________________________________________________________________
Share what Santa brought you
https://www.mycooluncool.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freedesktop.org/archives/dbus/attachments/20080215/3e9c325f/attachment.htm 


More information about the dbus mailing list