Save some lines

This commit is contained in:
sonny 2020-05-24 12:31:19 +02:00
parent 0ab3e943eb
commit c3f831e14b

View file

@ -47,13 +47,9 @@ class FeedBuilder(Builder):
def create_posts(self, stream): def create_posts(self, stream):
data, stream = stream data, stream = stream
entries = []
with FeedDuplicateHandler(stream.rule) as duplicate_handler: with FeedDuplicateHandler(stream.rule) as duplicate_handler:
try: entries = data.get("entries", [])
entries = data["entries"]
except KeyError:
pass
instances = self.build(entries, stream.rule) instances = self.build(entries, stream.rule)
posts = duplicate_handler.check(instances) posts = duplicate_handler.check(instances)
@ -84,8 +80,7 @@ class FeedBuilder(Builder):
if field == "published_parsed": if field == "published_parsed":
data[model_field] = build_publication_date(value, tz) data[model_field] = build_publication_date(value, tz)
elif field == "summary": elif field == "summary":
summary = self.sanitize_fragment(value) data[model_field] = self.sanitize_fragment(value)
data[model_field] = summary
else: else:
data[model_field] = value data[model_field] = value