Comment 2 for bug 462890

Revision history for this message
Markus Korn (thekorn) wrote :

I implemented a Properties interface in lp:~thekorn/zeitgeist/dbus.properties
The 'version' property is a read-only property which returns a version tuple.

Example usage:

>>> from zeitgeist.dbusutils import DBusInterface
>>> iface = DBusInterface()
>>> iface.version()
dbus.Struct((dbus.Int32(0), dbus.Int32(3), dbus.Int32(0)), signature=None, variant_level=1)
>>> map(int, iface.version())
[0, 3, 0]
>>> iface.version() > (0, 1, 0)
True
>>> iface.version() > (1, 5, 0)
False

Or in a terminal

markus@thekorn ~ % dbus-send --print-reply --dest=org.gnome.zeitgeist /org/gnome/zeitgeist org.freedesktop.DBus.Properties.Get string:"org.gnome.zeitgeist" string:"version"
method return sender=:1.170 -> dest=:1.171 reply_serial=2
   variant struct {
         int32 0
         int32 3
         int32 0
      }
markus@thekorn ~ % dbus-send --print-reply --dest=org.gnome.zeitgeist /org/gnome/zeitgeist org.freedesktop.DBus.Properties.GetAll string:"org.gnome.zeitgeist"
method return sender=:1.179 -> dest=:1.180 reply_serial=2
   array [
      dict entry(
         string "version"
         variant struct {
               int32 0
               int32 3
               int32 0
            }
      )
   ]
markus@thekorn ~ % dbus-send --print-reply --dest=org.gnome.zeitgeist /org/gnome/zeitgeist org.freedesktop.DBus.Properties.Set string:"org.gnome.zeitgeist" string:"version" string:"booo"
Error org.freedesktop.DBus.Python.AttributeError: Traceback (most recent call last):
  File "/usr/lib/pymodules/python2.6/dbus/service.py", line 702, in _message_cb
    retval = candidate_method(self, *args, **keywords)
  File "/media/devel/gnome-zeitgeist/zeitgeist/dbus.properties/zeitgeist/../_zeitgeist/engine/remote.py", line 265, in Set
    raise AttributeError(property_name)
AttributeError: version

1 markus@thekorn ~ %