Mercurial > libervia-backend
changeset 1243:b4a264915ea9
plugins groupblogs: fixes the massive retrieval callback (loop variable was misused in a lambda callback)
author | souliane <souliane@mailoo.org> |
---|---|
date | Sun, 19 Oct 2014 02:48:11 +0200 |
parents | f584fbda4773 |
children | c3884a63efde |
files | src/plugins/plugin_misc_groupblog.py src/plugins/plugin_xep_0060.py |
diffstat | 2 files changed, 10 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- 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):
--- 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)