Ticket #7 (closed defect: fixed)
Service Discovery items responses should include the node identifier.
| Reported by: | ralphm | Owned by: | ralphm |
|---|---|---|---|
| Priority: | normal | Milestone: | 0.5 |
| Component: | generic | Keywords: | |
| Cc: | ralph, ff |
Description
The _onDiscoItems should return the node identifier too. It's easily fixed with one line of code:
def _onDiscoItems(self, iq): requestor = jid.internJID(iq["from"]) target = jid.internJID(iq["to"]) nodeIdentifier = iq.query.getAttribute("node") def toResponse(results): items = [] for i in results: items.extend(i[1]) response = domish.Element((NS_ITEMS, 'query')) response["node"] = nodeIdentifier # <==== for item in items: response.addChild(item) return response
Change History
comment:2 Changed 5 years ago by tofu
It does need some more doc strings, but why did you change the NS_* names? I know it makes sense when you import them like from disco import NS_DISCO_ITEMS, but I think it is a bit redundant when you just import disco and use them like disco.NS_DISCO_ITEMS, I think disco.NS_ITEMS is what it should be. :)
comment:3 Changed 5 years ago by ralphm
On request by jack and also for consistency with the other modules. In naming for these things, a bit of redundancy is nice. I makes reading parts of code easier, and you can do things like from wokkel.disco import NS_DISCO_ITEMS.
comment:4 Changed 5 years ago by tofu
Ok. That is cool, so once the doc strings are in then we can merge this.

Although the fix is indeed pretty simple, I went out and made the disco module more testable, and also changed the NS_* names for consistency. It needs more doc strings, still.
See source:branches/disco-responses-7.