Mercurial > libervia-backend
comparison 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 |
comparison
equal
deleted
inserted
replaced
3491:2bd75fc2555d | 3492:fa796612adad |
---|---|
1179 | 1179 |
1180 def eb(failure_): | 1180 def eb(failure_): |
1181 log.warning(f"Error while parsing item: {failure_.value}") | 1181 log.warning(f"Error while parsing item: {failure_.value}") |
1182 | 1182 |
1183 d = defer.gatherResults([item_cb(item).addErrback(eb) for item in items]) | 1183 d = defer.gatherResults([item_cb(item).addErrback(eb) for item in items]) |
1184 d.addCallback(lambda parsed_items: (parsed_items, metadata)) | 1184 d.addCallback(lambda parsed_items: ( |
1185 [i for i in parsed_items if i is not None], | |
1186 metadata | |
1187 )) | |
1185 return d | 1188 return d |
1186 | 1189 |
1187 def serDList(self, results, failure_result=None): | 1190 def serDList(self, results, failure_result=None): |
1188 """Serialise a DeferredList result | 1191 """Serialise a DeferredList result |
1189 | 1192 |