Opened 13 years ago

Closed 13 years ago

Last modified 13 years ago

#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 (5)

comment:1 Changed 13 years ago by ralphm

  • Status changed from new to assigned

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.

comment:2 Changed 13 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 13 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 13 years ago by tofu

Ok. That is cool, so once the doc strings are in then we can merge this.

comment:5 Changed 13 years ago by ralphm

  • Resolution set to fixed
  • Status changed from assigned to closed

(In [140]) If provided, return NodeID in the response for Service Discovery requests.

This also renames the namespace constants to include DISCO in their name and provides better tests and docstrings.

Author: ralphm. Reviewer: tofu. Fixes #7.

Note: See TracTickets for help on using tickets.