Skip to content

Commit

Permalink
avoid duplicated keywords in NTB NITF (#458)
Browse files Browse the repository at this point in the history
SDNTB-769
  • Loading branch information
petrjasek authored Jun 12, 2023
1 parent 93e8746 commit 288aae0
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 6 deletions.
2 changes: 1 addition & 1 deletion server/ntb/publish/ntb_nitf.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ def format(self, original_article, subscriber, codes=None, encoding="us-ascii"):
if tz is None:
# first time this method is launched
# we set timezone and NTB specific filter
tz = pytz.timezone(app.config["DEFAULT_TIMEZONE"])
tz = pytz.timezone(app.config.get("DEFAULT_TIMEZONE", "Europe/Oslo"))
try:
if article.get("body_html"):
article["body_html"] = article["body_html"].replace("<br>", "<br />")
Expand Down
4 changes: 0 additions & 4 deletions server/ntb/publish/ntb_nitf_multiservice.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,6 @@ def _format_slugline(self, article, tobject):
"""Avoid slugline in key-list."""
pass

def _format_docdata(self, article, docdata):
super()._format_docdata(article, docdata)
self._format_imatrics_entities(article, docdata)

def _format_imatrics_entities(self, article, docdata):
imatrics_topics = [
s
Expand Down
2 changes: 1 addition & 1 deletion server/ntb/tests/publish/ntb_nitf_multiservice_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def setUp(self):
self.nitf_xml = etree.fromstring(self.doc, None)

def test_imatrics_entities(self):
keywords = self.nitf_xml.findall("head/docdata/key-list/keyword")
keywords = self.nitf_xml.findall(".//keyword")
self.assertEqual(4, len(keywords))
self.assertEqual(keywords[0].get("key"), "Olje")
self.assertEqual(keywords[1].get("key"), "Stortinget")
Expand Down

0 comments on commit 288aae0

Please sign in to comment.