From 32d9bc9d9dfea03792636ef62d70911d0ec25837 Mon Sep 17 00:00:00 2001 From: pictuga Date: Mon, 24 Jan 2022 09:34:57 +0000 Subject: [PATCH] feeds: proceed with conversion when rules do not match --- morss/feeds.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/morss/feeds.py b/morss/feeds.py index 15a7b75..3563216 100644 --- a/morss/feeds.py +++ b/morss/feeds.py @@ -186,11 +186,12 @@ class ParserBase(object): return self.convert(FeedHTML).tostring(**k) def convert(self, TargetParser): - if type(self) == TargetParser: - return self - target = TargetParser() + if type(self) == TargetParser and self.rules == target.rules: + # check both type *AND* rules (e.g. when going from freeform xml to rss) + return self + for attr in target.dic: if attr == 'items': for item in self.items: