[sugar] [patch][connect-activity] Update to high-level API in latest dbus-python
Simon McVittie
simon.mcvittie
Tue May 8 07:44:00 EDT 2007
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On Tue, 08 May 2007 at 11:27:40 +0100, Dafydd Harries wrote:
> Ar 04/05/2007 am 19:16, ysgrifennodd Simon McVittie:
> > -def guess(x):
> > ...
>
> telepathy-python's examples/account.py currently does something like guess()
> rather than something like decode(). That should probably be changed.
Agreed.
> > -# Needed for now, as dbus-python's high-level API doesn't support connecting
> > -# to arbitrary addresses, or daemonless connections.
> > import _dbus_bindings
> > import dbus.lowlevel
>
> Are these still necessary?
Removed in a later patch.
> > +dbus_main_loop = DBusGMainLoop(set_as_default=True)
>
> Statements in libraries considered dubious. In other words, "import x"
> shouldn't cause side-effects.
"import dbus.glib" causes side-effects (and is vaguely deprecated for
that reason), I'm just making it more explicit here. This should probably
be moved to activity.py and gtkui.py though.
I believe bits of Sugar also import dbus.glib, causing the same magical
side-effects.
> What does this actually do? Does it create a new GLib mainloop? Will it cause
> odd things to happen if another DBusGMainLoop loop has already been installed?
It uses the global default GLib main loop, and is harmless to do
multiple times.
> > def print_dbus_message(msg):
> ...
> Is this still used? If not, remove it.
Will do.
> > +logging.basicConfig()
> > +_logger = logging.getLogger('connect-activity.client')
>
> Is this idempotent? The documentation is ambiguous:
>
> Does basic configuration for the logging system by creating a StreamHandler
> with a default Formatter and adding it to the root logger. The functions
> debug(), info(), warning(), error() and critical() will call basicConfig()
> automatically if no handlers are defined for the root logger.
>
> Does this cause side effects if a handler is defined for the root logger
> already? (Whatever that means. :P)
logging.basicConfig() has no effect if there is already a handler on the
root logger, although this call ought to be in gtkui.py really (Sugar
already sets up a handler for the root logger).
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: OpenPGP key: http://www.pseudorandom.co.uk/2003/contact/ or pgp.net
iD8DBQFGQGKAWSc8zVUw7HYRAp6yAKCepEPYtohU8Zlzm1OClOWWUlphvwCfV8cn
oACzqPBy7hWwO6Pw2slXPW4=
=eka3
-----END PGP SIGNATURE-----
More information about the Sugar-devel
mailing list