From aad2398e69cd52862175a79c8087088d0a160b6c Mon Sep 17 00:00:00 2001 From: pictuga Date: Sun, 5 Apr 2020 21:50:38 +0200 Subject: [PATCH] feeds: turns out lxml.etree doesn't have drop_tag --- morss/feeds.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/morss/feeds.py b/morss/feeds.py index 9eee168..0cf7670 100644 --- a/morss/feeds.py +++ b/morss/feeds.py @@ -402,13 +402,14 @@ class ParserXML(ParserBase): else: if html_rich: - # atom stuff - if 'atom' in rule: - match.attrib['type'] = 'xhtml' - self._clean_node(match) match.append(lxml.html.fragment_fromstring(value, create_parent='div')) - match.find('div').drop_tag() + + if self.rules['mode'] == 'html': + match.find('div').drop_tag() # not supported by lxml.etree + + else: # i.e. if atom + match.attrib['type'] = 'xhtml' else: if match is not None and len(match):