diff options
author | Simon McVittie <simon.mcvittie@collabora.co.uk> | 2007-10-17 11:53:24 (GMT) |
---|---|---|
committer | Simon McVittie <simon.mcvittie@collabora.co.uk> | 2007-10-17 11:53:24 (GMT) |
commit | 3227653cd311be9d4a09c5076fe3ec331d4d6a96 (patch) | |
tree | 1161e648a24fef849b8c5843e27c1652703df2eb /lib/sugar/presence/presenceservice.py | |
parent | 4f41f300d8eec783335e95ef3b37da9f8a080b3f (diff) |
Avoid misleading warning every time an activity starts (#4266)
Diffstat (limited to 'lib/sugar/presence/presenceservice.py')
-rw-r--r-- | lib/sugar/presence/presenceservice.py | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/lib/sugar/presence/presenceservice.py b/lib/sugar/presence/presenceservice.py index a9c834c..dea0c7c 100644 --- a/lib/sugar/presence/presenceservice.py +++ b/lib/sugar/presence/presenceservice.py @@ -302,21 +302,20 @@ class PresenceService(gobject.GObject): error_handler=lambda e:self._get_activities_error_cb(error_handler, e)) - def get_activity(self, activity_id): - """Retrieve single Activity object for the given unique id - - activity_id -- unique ID for the activity - - returns single Activity object or None if the activity + def get_activity(self, activity_id, warn_if_none=True): + """Retrieve single Activity object for the given unique id + + activity_id -- unique ID for the activity + + returns single Activity object or None if the activity is not found using GetActivityById on the service """ try: act_op = self._ps.GetActivityById(activity_id) except dbus.exceptions.DBusException, err: - _logger.warn( - """Unable to retrieve activity handle for %r from presence service: %s""" - % (activity_id, err) - ) + if warn_if_none: + _logger.warn("Unable to retrieve activity handle for %r from " + "presence service: %s", activity_id, err) return None return self._new_object(act_op) |