From: Ed Page Date: Sat, 29 May 2010 00:39:54 +0000 (-0500) Subject: Imitating butterfly in being forgiving X-Git-Url: https://vcs.maemo.org/git/?a=commitdiff_plain;h=498fd1daeb6186e07778917c834e55cc49dba427;hp=afa4cdb64e451070cf87cc02f257c582fa057f53;p=theonering Imitating butterfly in being forgiving See """ Make GetContactAttributes() more tolerant. See http://bugs.freedesktop.org/show_bug.cgi?id=27325 """ --- diff --git a/src/contacts.py b/src/contacts.py index d57d1e1..340ca11 100644 --- a/src/contacts.py +++ b/src/contacts.py @@ -39,11 +39,12 @@ class ContactsMixin(telepathy.server.ConnectionInterfaceContacts): out_signature='a{ua{sv}}', sender_keyword='sender') def GetContactAttributes(self, handles, interfaces, hold, sender): #InspectHandle already checks we're connected, the handles and handle type. + supportedInterfaces = set() for interface in interfaces: - if interface not in self.ATTRIBUTES: - raise telepathy.errors.InvalidArgument( - 'Interface %s is not supported by GetContactAttributes' % (interface) - ) + if interface in self.ATTRIBUTES: + supportedInterfaces.add(interface) + else: + _moduleLogger.debug("Ignoring unsupported interface %s" % interface) handle_type = telepathy.HANDLE_TYPE_CONTACT ret = dbus.Dictionary(signature='ua{sv}') @@ -67,8 +68,9 @@ class ContactsMixin(telepathy.server.ConnectionInterfaceContacts): # Attributes from the interface org.freedesktop.Telepathy.Connection # are always returned, and need not be requested explicitly. - interfaces = set(interfaces + [telepathy.CONNECTION]) - for interface in interfaces: + supportedInterfaces.add(telepathy.CONNECTION) + + for interface in supportedInterfaces: interface_attribute = interface + '/' + self.ATTRIBUTES[interface] results = functions[interface](handles) for handle, value in results: