Mercurial > libervia-backend
comparison sat/plugins/plugin_xep_0234.py @ 3859:3ef988734869
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.
author | Goffi <goffi@goffi.org> |
---|---|
date | Wed, 20 Jul 2022 17:12:29 +0200 |
parents | bbf92ef05f38 |
children | 8e7d5796fb23 |
comparison
equal
deleted
inserted
replaced
3858:6e785662dd7d | 3859:3ef988734869 |
---|---|
665 if info_content_name != content_name: | 665 if info_content_name != content_name: |
666 # it was for an other content... | 666 # it was for an other content... |
667 return | 667 return |
668 file_data = content_data["application_data"]["file_data"] | 668 file_data = content_data["application_data"]["file_data"] |
669 try: | 669 try: |
670 file_elt = next(elt.elements((NS_JINGLE_FT, "file"))) | 670 file_elt = next(elt.elements(NS_JINGLE_FT, "file")) |
671 except StopIteration: | 671 except StopIteration: |
672 raise exceptions.DataError | 672 raise exceptions.DataError |
673 algo, file_data["given_file_hash"] = self._hash.parseHashElt(file_elt) | 673 algo, file_data["given_file_hash"] = self._hash.parseHashElt(file_elt) |
674 if algo != file_data.get("hash_algo"): | 674 if algo != file_data.get("hash_algo"): |
675 log.warning( | 675 log.warning( |