From 49c403f76c990fd53d2ebc68a33d97e838f66f6a Mon Sep 17 00:00:00 2001 From: rbi-aap Date: Tue, 3 Sep 2024 16:00:05 +1000 Subject: [PATCH] update for unit_test block_media --- newsroom/wire/utils.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/newsroom/wire/utils.py b/newsroom/wire/utils.py index 86a289cff..74c3d6c34 100644 --- a/newsroom/wire/utils.py +++ b/newsroom/wire/utils.py @@ -9,9 +9,9 @@ def get_picture(item): def get_body_picture(item): - pictures = [assoc for assoc in item.get('associations', {}).values() if assoc.get('type') == 'picture'] - if pictures: - return pictures[0] + pictures = [assoc for assoc in item.get('associations', {}).values() + if assoc is not None and assoc.get('type') == 'picture'] + return pictures[0] if pictures else None def get_caption(picture):