Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add byline to ntb ninjs 2 output #456

Merged
merged 1 commit into from
May 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions server/ntb/publish/ntb_ninjs.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,9 @@ def _transform_to_ninjs(self, article, subscriber, recursive=True):
{"name": utils.get_distributor(article)},
]

if article.get("byline"):
ninjs["by"] = article["byline"]

if recursive: # should only run at the end, so do this on top level item only
convert_dicts_to_lists(ninjs)

Expand Down
2 changes: 2 additions & 0 deletions server/ntb/tests/publish/ntb_ninjs_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ class Ninjs2FormatterTest(TestCase):
"template": "5ba11fec0d6f1301ac3cbd15",
"headline": "custom media field multi",
"slugline": "test custom media2",
"byline": "byline",
"guid": "123",
"subject": [
{
Expand Down Expand Up @@ -338,6 +339,7 @@ def test_format_item(self):
],
"infosources": [{"name": "NTB"}],
"copyrightholder": "NTB",
"by": "byline",
}

self.assertEqual(ninjs, expected_item)
Expand Down