[Telepathy] telepathy-python -- generating method decorators

Jonny Lamb jonny.lamb at collabora.co.uk
Sun Nov 8 05:59:58 PST 2009


On Sun, Nov 08, 17:03:29 +1100, Danielle Madeley wrote:
> One of the things when writing a D-Bus service in Python is that you
> have to know the type signatures of the methods to pass to the
> dbus.service.method decorator. This is something that's very easy to
> typo, also something that's already stored in the spec.

Well, unless I'm misunderstanding you, you don't have to type these
out. If you subclass an object, its method decorators are still around
on overridden methods. For example:

    class MyFirstObserver(telepathy._generated.ClientObserver):

       # oh look, no @dbus.service.method, because it already was
       # declared in the parent class.
       def ObserveChannels(self, account, connection, cahnnels,
                           dispatch_operation, requests_satisfied,
                           observer_info):
           # misc

It would be nicer to import ClientObserver into tp.client as Observer
and maybe add some helper methods, instead of importing from
_generated.

-- 
Jonny Lamb, UK
jonny.lamb at collabora.co.uk


More information about the telepathy mailing list