python D-Bus: get_type() -> contant names?

Simon McVittie simon.mcvittie at collabora.co.uk
Fri Mar 14 05:58:26 PDT 2008


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Fri, 14 Mar 2008 at 11:48:08 +0000, Alban Crequy wrote:
> What is the name of contants in python for
> DBUS_MESSAGE_TYPE_{METHOD_{CALL,RETURN},ERROR,SIGNAL}? I want to avoid
> using "if msg.get_type() == 4".

You can use "if isinstance(msg, SignalMessage)" etc. instead. Import the
classes from the dbus.lowlevel module.

I would accept patches that added these constants to dbus.lowlevel too
(please file a bug on bugs.freedesktop.org).

    Simon
-----BEGIN PGP SIGNATURE-----

iD8DBQFH2nZxWSc8zVUw7HYRAoB8AJ0Y03pRLhFjtWO+sQK+DesG9TTHkwCeKbrF
SDEYoEUkGdAW1oLNXSPXab0=
=nmgo
-----END PGP SIGNATURE-----


More information about the dbus mailing list