feeds: add ability to convert to another typo of feed

master
pictuga 2020-03-17 14:02:24 +01:00
parent 4ba4d73ce6
commit 1e714ab34b
1 changed files with 13 additions and 0 deletions

View File

@ -133,6 +133,19 @@ class ParserBase(object):
template = engine.get_template('reader')
return template.render({'feed': self}).encode('utf-8')
def convert(self, TargetParser):
target = TargetParser()
for attr in target.dic:
if attr == 'items':
for item in self.items:
target.append(item)
else:
setattr(target, attr, getattr(self, attr))
return target
def iterdic(self):
for element in self.dic:
value = getattr(self, element)