# HG changeset patch # User souliane # Date 1413679691 -7200 # Node ID b4a264915ea9ec687d3af82da1b53348cf8ea18b # Parent f584fbda4773e75f4369a0ca5ef51d3a869de3c0 plugins groupblogs: fixes the massive retrieval callback (loop variable was misused in a lambda callback) diff -r f584fbda4773 -r b4a264915ea9 src/plugins/plugin_misc_groupblog.py --- a/src/plugins/plugin_misc_groupblog.py Sat Oct 18 20:23:12 2014 +0200 +++ b/src/plugins/plugin_misc_groupblog.py Sun Oct 19 02:48:11 2014 +0200 @@ -685,12 +685,16 @@ data = {publisher: self.getNodeName(publisher) for publisher in jids} d_dict = yield self.host.plugins["XEP-0060"].getItemsFromMany(client.item_access_pubsub, data, max_items=max_items, profile_key=profile) + + def cb(jid): + def res(gbdata): + return (jid.full(), gbdata) + return res + for publisher, d in d_dict.items(): d.addCallback(self._itemsConstruction, publisher, client) - d.addCallback(lambda gbdata: (publisher.full(), gbdata)) - # consume the failure "StanzaError with condition u'item-not-found'" - # when the node doesn't exist (e.g that JID hasn't posted any message) - result = yield defer.DeferredList(d_dict.values(), consumeErrors=True) + d.addCallback(cb(publisher)) + result = yield defer.DeferredList(d_dict.values(), consumeErrors=False) defer.returnValue({value[0]: value[1] for success, value in result if success}) def subscribeGroupBlog(self, pub_jid, profile_key=C.PROF_KEY_NONE): @@ -739,9 +743,7 @@ node_ids = [self.getNodeName(publisher) for publisher in jids] d_list = yield self.host.plugins["XEP-0060"].subscribeToMany(client.item_access_pubsub, node_ids, profile_key=profile_key) - # consume the failure "StanzaError with condition u'item-not-found'" - # when the node doesn't exist (e.g that JID hasn't posted any message) - result = yield defer.DeferredList(d_list, consumeErrors=True) + result = yield defer.DeferredList(d_list, consumeErrors=False) defer.returnValue(result) def deleteAllGroupBlogsAndComments(self, profile_key=C.PROF_KEY_NONE): diff -r f584fbda4773 -r b4a264915ea9 src/plugins/plugin_xep_0060.py --- a/src/plugins/plugin_xep_0060.py Sat Oct 18 20:23:12 2014 +0200 +++ b/src/plugins/plugin_xep_0060.py Sun Oct 19 02:48:11 2014 +0200 @@ -215,7 +215,7 @@ @param sub_id (str): optional subscription identifier. @param options (list): optional list of subscription options @param profile_key (str): %(doc_profile_key)s - @return: dict binding a subset of the keys of data to Deferred instances. + @return: list of Deferred instances. """ profile, client = self.__getClientNProfile(profile_key, 'subscribe nodes') found_nodes = yield self.listNodes(service, profile=profile)