From 33ab2d4de519013433aacac90e33d6cf928adbaa Mon Sep 17 00:00:00 2001 From: Mark Pittaway Date: Fri, 2 Feb 2024 17:49:26 +1100 Subject: [PATCH] fix lint --- server/planning/common.py | 6 +----- server/planning/feed_parsers/superdesk_planning_xml.py | 5 ++++- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/server/planning/common.py b/server/planning/common.py index 69e49dfe1..4cb81b839 100644 --- a/server/planning/common.py +++ b/server/planning/common.py @@ -844,10 +844,6 @@ def update_ingest_on_patch(updates: Dict[str, Any], original: Dict[str, Any]): def get_coverage_from_planning(planning_item: Planning, coverage_id: str) -> Optional[Coverage]: return next( - ( - coverage - for coverage in planning_item.get("coverages") or [] - if coverage.get("coverage_id") == coverage_id - ), + (coverage for coverage in planning_item.get("coverages") or [] if coverage.get("coverage_id") == coverage_id), None, ) diff --git a/server/planning/feed_parsers/superdesk_planning_xml.py b/server/planning/feed_parsers/superdesk_planning_xml.py index 3a11944d1..54041f797 100644 --- a/server/planning/feed_parsers/superdesk_planning_xml.py +++ b/server/planning/feed_parsers/superdesk_planning_xml.py @@ -250,8 +250,11 @@ def get_coverage_details(self, news_coverage_elt: Element, item: Planning, origi """ coverage_id = news_coverage_elt.get("id") - planning = self.parse_coverage_planning(news_coverage_elt, item) + if coverage_id is None: + logger.warning("Unable to process coverage details, no coverage id found in ingest source") + return None + planning = self.parse_coverage_planning(news_coverage_elt, item) if planning is None: logger.warning(f"Failed to process coverage '{coverage_id}', planning details not found") return None