plugins groupblogs: fixes the massive retrieval callback (loop variable was misused in a lambda callback)
This commit is contained in:
parent
0d80ce6cc2
commit
dd0c7fab68
2 changed files with 10 additions and 8 deletions
|
|
@ -685,12 +685,16 @@ class GroupBlog(object):
|
|||
|
||||
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 @@ class GroupBlog(object):
|
|||
|
||||
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):
|
||||
|
|
|
|||
|
|
@ -215,7 +215,7 @@ class XEP_0060(object):
|
|||
@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)
|
||||
|
|
|
|||
Loading…
Reference in a new issue