Skip to content

Commit

Permalink
avoid using BELGA/AG source (#401)
Browse files Browse the repository at this point in the history
* avoid using BELGA/AG source

it would make it to the output as creditline and break
the routing. should be BELGA instead.

SDBELGA-684

* avoid BELGA.AG creditline in belga output
  • Loading branch information
petrjasek authored Oct 26, 2022
1 parent 95825e6 commit 559d84d
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
2 changes: 1 addition & 1 deletion server/belga/macros/brief_internal_routing.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
COUNTRY = 'country'
PRODUCTS = 'services-products'

BRIEF_SOURCE = BRIEF_CREDIT = 'BELGA/AG'
BRIEF_SOURCE = BRIEF_CREDIT = 'BELGA'
DEFAULT_PRODUCT = 'NEWS/GENERAL'
PRODUCT_MAPPING = {
'NEWS/SPORTS': ('SPN/', 'SPF/'),
Expand Down
5 changes: 4 additions & 1 deletion server/belga/publish/belga_newsml_1_2.py
Original file line number Diff line number Diff line change
Expand Up @@ -964,7 +964,10 @@ def _format_newslines(self, newscomponent_2_level, item):
# SDBELGA-672
for subject in item.get("subject", []):
if subject.get("scheme") == "sources":
SubElement(newslines, "CreditLine").text = subject.get("name")
name = subject.get("name")
if "belga" in name.lower(): # avoid BELGA-AG BELGA/EG etc. should be just BELGA
name = self.DEFAULT_CREDITLINE
SubElement(newslines, "CreditLine").text = name
break
else:
if item.get("source") and item.get("ingest_provider"):
Expand Down
8 changes: 4 additions & 4 deletions server/tests/macros/brief_internal_routing_macro_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,13 +88,13 @@ def test_callback(self):
self.assertEqual(self.profiles[0], item['profile'])
self.assertEqual(2, item['urgency'])
self.assertIn({
'name': 'BELGA/AG',
'qcode': 'BELGA/AG',
'name': 'BELGA',
'qcode': 'BELGA',
'scheme': 'credits',
}, item['subject'])
self.assertIn({
'name': 'BELGA/AG',
'qcode': 'BELGA/AG',
'name': 'BELGA',
'qcode': 'BELGA',
'scheme': 'sources',
}, item['subject'])

Expand Down

0 comments on commit 559d84d

Please sign in to comment.