[sugar] DBus-python and signals with changing types

Benjamin M. Schwartz bmschwar
Mon Feb 4 09:51:32 EST 2008

Hash: SHA1

John (J5) Palmieri wrote:
> Perhaps you are going about it the wrong way. 

> First of all decorators
> are executed when the method is parsed, way before the class is
> instantiated so you will get an error there.

> Also by sending different
> signatures you are going to be giving back false introspect information
> and basically making it harder for non-dynamically bound languages to
> communicate with you.  Also why would you make an external app specify
> byte array or not?
I am writing a library for Python Activity developers.  I would like to provide
the necessary plumbing to ensure that Activities can share a unified data model
in the face of arbitrary network problems, including unexpected group splits and
merges.  Thus, I am writing code that talks over D-Bus tubes, but is sending
messages whose type is controlled by whoever is using the library.  Since I do
not know that developer's types or preferences ahead of time, I would like to
allow them to control the types, and also message parameters (such as
byte_arrays and utf8_strings).

After talking to Simon McVittie, it seems that I can come close by setting all
my signatures to variant.  The user may then either trust the introspection, or
set dbus types explicitly by constructing messages in this style:

dbus.Struct(('a', 42), signature='su')

This doesn't solve the byte_arrays problem, but that is less important.

Something that would be nice, in the future, is support for programmatically
generated interfaces.  For example, Java now has support for parameterized
interfaces.  Python is much more dynamic, but there is no support in dbus-python
for setting the interface at constructor-time.  That would be an improvement,
though still not as Pythonic as setting the types on each call.

- --Ben
Version: GnuPG v2.0.7 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org


More information about the Sugar-devel mailing list