Avoid misleading warning every time an activity starts (#4266)

This commit is contained in:
Simon McVittie
2007-10-17 12:53:24 +01:00
parent 4f41f300d8
commit 3227653cd3
3 changed files with 15 additions and 13 deletions
+9 -10
View File
@@ -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)