Skip to content

Commit

Permalink
Merge pull request #937 from marwoodandrew/fix-apple
Browse files Browse the repository at this point in the history
fix apple formatter handling null editor associations
  • Loading branch information
marwoodandrew authored Oct 25, 2024
2 parents 0e08455 + d62e952 commit 6a268f9
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion server/aap/publish/formatters/aap_apple_news_formatter.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ def _remove_unwanted_embeds(self, article):

# can only handle pictures at the moment
for key, item in (article.get("associations") or {}).items():
if key.startswith("editor_") and item.get("type") != 'picture':
if item and key.startswith("editor_") and item.get("type", "") != 'picture':
remove_keys.append(key)

self._remove_embeds(article, remove_keys)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,8 @@ def test_format_article_with_embeds(self):
'Extinction Rebellion rally in Sydney, '
'Thursday, October 31, 2019.'},
'editor_0': {'type': 'video'},
'editor_1': {'type': 'picture'}}
'editor_1': {'type': 'picture'},
'editor_2': None}
article['fields_meta'] = {
"body_html": {
"draftjsState": [
Expand Down

0 comments on commit 6a268f9

Please sign in to comment.