Mercurial > libervia-backend
diff sat/plugins/plugin_xep_0060.py @ 3492:fa796612adad
plugin XEP-0277: better resilience to broken items:
- if `author` element can't be found, `publisher` attribute, then `IQ`'s `from` attributes
are used as fallback to find author jid
- fix categories (tags) parsing if `author` element is not found
- remove items which have failed parsing from `mbGet` results (instead of using `None`).
author | Goffi <goffi@goffi.org> |
---|---|
date | Sat, 27 Mar 2021 14:38:27 +0100 |
parents | be6d91572633 |
children | 02eec2a5b5f9 |
line wrap: on
line diff
--- a/sat/plugins/plugin_xep_0060.py Sat Mar 27 14:35:07 2021 +0100 +++ b/sat/plugins/plugin_xep_0060.py Sat Mar 27 14:38:27 2021 +0100 @@ -1181,7 +1181,10 @@ log.warning(f"Error while parsing item: {failure_.value}") d = defer.gatherResults([item_cb(item).addErrback(eb) for item in items]) - d.addCallback(lambda parsed_items: (parsed_items, metadata)) + d.addCallback(lambda parsed_items: ( + [i for i in parsed_items if i is not None], + metadata + )) return d def serDList(self, results, failure_result=None):