[python] Multiple interfaces for one method / Register method with other name
René 'Necoro' Neumann
lists at necoro.eu
Tue Nov 6 13:46:40 PST 2007
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hi all,
I have a question concerning the python-dbus bindings:
Say I have a class A (=> a dbus-object A) which has several methods. And
for some reasons (here: allow API versioning) I want that each method is
defined in different interfaces.
How could I do this?
I would see three ways, but I think none of them is working:
class A (dbus.service.Object):
# the first method: multiple decorators
@dbus.service.method ("Interface1", ...)
@dbus.service.method ("Interface2", ...)
def foo1 (...):
pass
# the second method: multiple interfaces in one decorator - as list
@dbus.service.method (["Interface1", "Interface2"], ...)
def foo2 (...):
pass
# the third way: register a function under a different name
# this would also allow to have one function with different signatures
in different interfaces
@dbus.service.method("Interface1", ...)
def foo3 (...):
pass
@dbus.service.method("Interface2", as_method="foo3", ...)
def foo3_int2 (...):
pass
I think the second way would be really nice to have, to ease something
like this.
And additional the third one, with passing a different name under which
the function should be visible in DBus. I think there are some usecases
where this would come in really handy :)
Regards,
René
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFHMODA4UOg/zhYFuARAhLwAJ9ckbZFqDBz9wcmCDZjImEX0FRywQCgg+VJ
oURY8AKu1UMYK0xmr3VLgiY=
=nvmL
-----END PGP SIGNATURE-----
More information about the dbus
mailing list