Mercurial > libervia-backend
changeset 1216:8ad37c3d58a9
memory (disco): add nodeIdentifier parameter to getItems
author | souliane <souliane@mailoo.org> |
---|---|
date | Mon, 22 Sep 2014 20:34:29 +0200 |
parents | d9c399ec5dd9 |
children | 318eab3f93f8 |
files | src/memory/disco.py |
diffstat | 1 files changed, 8 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/src/memory/disco.py Mon Sep 22 19:24:07 2014 +0200 +++ b/src/memory/disco.py Mon Sep 22 20:34:29 2014 +0200 @@ -116,10 +116,11 @@ return d @defer.inlineCallbacks - def getItems(self, jid_=None, profile_key=C.PROF_KEY_NONE): + def getItems(self, jid_=None, nodeIdentifier='', profile_key=C.PROF_KEY_NONE): """get disco items from jid_, cache them for our own server - @param jid_: jid of the target, or None for profile's server + @param jid_ (jid.JID): jid of the target, or None for profile's server + @param nodeIdentifier (str): optional node identifier @param profile_key: %(doc_profile_key)s @return: a Deferred which fire disco.DiscoItems """ @@ -132,10 +133,10 @@ log.debug("[%s] disco items are in cache" % jid_.full()) except KeyError: log.debug("Caching [%s] disco items" % jid_.full()) - items = yield client.disco.requestItems(jid_) + items = yield client.disco.requestItems(jid_, nodeIdentifier) self.host.memory.updateEntityData(jid_, "DISCO_ITEMS", items, client.profile) else: - items = yield client.disco.requestItems(jid_) + items = yield client.disco.requestItems(jid_, nodeIdentifier) defer.returnValue(items) @@ -168,7 +169,7 @@ defers_list.append(info_d) return defer.DeferredList(defers_list) - d = self.getItems(jid_, profile_key) + d = self.getItems(jid_, profile_key=profile_key) d.addCallback(gotItems) d.addCallback(lambda dummy: found_entities) reactor.callLater(TIMEOUT, d.cancel) # FIXME: one bad service make a general timeout @@ -213,7 +214,7 @@ defer_list.append(infos_d) return defer.DeferredList(defer_list) - d = self.getItems(jid_, profile_key) + d = self.getItems(jid_, profile_key=profile_key) d.addCallback(gotItems) d.addCallback(lambda dummy: found_entities) reactor.callLater(TIMEOUT, d.cancel) # FIXME: one bad service make a general timeout @@ -261,5 +262,5 @@ @return: list of tu""" entity = jid.JID(entity_jid_s) - disco_items = yield self.getItems(entity, profile_key) + disco_items = yield self.getItems(entity, profile_key=profile_key) defer.returnValue([(item.entity.full(), item.nodeIdentifier or '', item.name or '') for item in disco_items])