core: fix calls to domish.Element.elements:

domish.Element.elements should be called with namespace and element name as 2 arguments,
but it has been confused in several places with the call to `domish.Element.addElement`
which is often done with a `(namespace, name)` tuple. Unfortunately calling with a tuple
is accepted and doesn't raise any error in `elements`, but this result in a wrong element
returned.

This patch fixes the erroneous calls.
This commit is contained in:
Goffi 2022-07-20 17:12:29 +02:00
commit 8d64157d88

View file

@ -966,7 +966,7 @@ class XEP_0060(object):
def cb(iq_elt):
try:
affiliations_elt = next(
iq_elt.pubsub.elements((pubsub.NS_PUBSUB, "affiliations"))
iq_elt.pubsub.elements(pubsub.NS_PUBSUB, "affiliations")
)
except StopIteration:
raise ValueError(
@ -977,7 +977,7 @@ class XEP_0060(object):
try:
return {
e["node"]: e["affiliation"]
for e in affiliations_elt.elements((pubsub.NS_PUBSUB, "affiliation"))
for e in affiliations_elt.elements(pubsub.NS_PUBSUB, "affiliation")
}
except KeyError:
raise ValueError(
@ -1009,7 +1009,7 @@ class XEP_0060(object):
def cb(iq_elt):
try:
affiliations_elt = next(
iq_elt.pubsub.elements((pubsub.NS_PUBSUB_OWNER, "affiliations"))
iq_elt.pubsub.elements(pubsub.NS_PUBSUB_OWNER, "affiliations")
)
except StopIteration:
raise ValueError(
@ -1402,7 +1402,7 @@ class XEP_0060(object):
iq_elt = await request.send(client.xmlstream)
try:
subscriptions_elt = next(
iq_elt.pubsub.elements((pubsub.NS_PUBSUB, "subscriptions"))
iq_elt.pubsub.elements(pubsub.NS_PUBSUB, "subscriptions")
)
except StopIteration:
raise ValueError(