From aa2dac55883c7d7c6326b63c13be62c25990463b Mon Sep 17 00:00:00 2001 From: marwoodandrew Date: Fri, 31 Mar 2017 12:36:29 +1100 Subject: [PATCH] [SDESK-998] Remove the embargo processing from the AAP formatters --- .../aap/publish/formatters/aap_ipnews_formatter.py | 1 - .../publish/formatters/aap_newscentre_formatter.py | 1 - server/aap/publish/formatters/aap_odbc_formatter.py | 13 ------------- server/aap/publish/formatters/aap_sms_formatter.py | 7 +------ server/aap/publish/formatters/anpa_formatter.py | 8 +------- 5 files changed, 2 insertions(+), 28 deletions(-) diff --git a/server/aap/publish/formatters/aap_ipnews_formatter.py b/server/aap/publish/formatters/aap_ipnews_formatter.py index 30024affb..f81b3e55d 100644 --- a/server/aap/publish/formatters/aap_ipnews_formatter.py +++ b/server/aap/publish/formatters/aap_ipnews_formatter.py @@ -76,7 +76,6 @@ def format_for_source(self, article, subscriber, source, codes=None): if self.is_first_part(article) and not pass_through: self.add_ednote(odbc_item, article) - self.add_embargo(odbc_item, article) self.add_byline(odbc_item, article) if not is_last_take: diff --git a/server/aap/publish/formatters/aap_newscentre_formatter.py b/server/aap/publish/formatters/aap_newscentre_formatter.py index 36ca735c1..5f6685745 100644 --- a/server/aap/publish/formatters/aap_newscentre_formatter.py +++ b/server/aap/publish/formatters/aap_newscentre_formatter.py @@ -56,7 +56,6 @@ def format_for_source(self, article, subscriber, source, codes=None): if self.is_first_part(article) and not pass_through: self.add_ednote(odbc_item, article) - self.add_embargo(odbc_item, article) self.add_byline(odbc_item, article) if not is_last_take: diff --git a/server/aap/publish/formatters/aap_odbc_formatter.py b/server/aap/publish/formatters/aap_odbc_formatter.py index 384970588..3dfa5f6ef 100644 --- a/server/aap/publish/formatters/aap_odbc_formatter.py +++ b/server/aap/publish/formatters/aap_odbc_formatter.py @@ -10,10 +10,8 @@ from superdesk.io.iptc import subject_codes from apps.packages import TakesPackageService from .aap_formatter_common import set_subject -from apps.archive.common import get_utc_schedule from .field_mappers.locator_mapper import LocatorMapper from .field_mappers.slugline_mapper import SluglineMapper -from superdesk.metadata.item import EMBARGO from eve.utils import config import superdesk from .unicodetoascii import to_ascii @@ -60,17 +58,6 @@ def get_odbc_item(self, article, subscriber, category, codes, pass_through=False return pub_seq_num, odbc_item - def add_embargo(self, odbc_item, article): - """ - Add the embargo text to the article if required - :param odbc_item: - :param article: - :return: - """ - if article.get(EMBARGO): - embargo = '{}{}\r\n'.format('Embargo Content. Timestamp: ', get_utc_schedule(article, EMBARGO).isoformat()) - odbc_item['article_text'] = embargo + odbc_item['article_text'] - def add_ednote(self, odbc_item, article): """ Add the editorial note if required diff --git a/server/aap/publish/formatters/aap_sms_formatter.py b/server/aap/publish/formatters/aap_sms_formatter.py index 22dcc3938..136dc88ad 100644 --- a/server/aap/publish/formatters/aap_sms_formatter.py +++ b/server/aap/publish/formatters/aap_sms_formatter.py @@ -10,10 +10,9 @@ from eve.utils import ParsedRequest from superdesk.publish.formatters import Formatter from .aap_formatter_common import map_priority -from apps.archive.common import get_utc_schedule import superdesk from superdesk.errors import FormatterError -from superdesk.metadata.item import ITEM_TYPE, CONTENT_TYPE, EMBARGO, CONTENT_STATE, ITEM_STATE +from superdesk.metadata.item import ITEM_TYPE, CONTENT_TYPE, CONTENT_STATE, ITEM_STATE import json from superdesk.etree import get_text @@ -37,10 +36,6 @@ def format(self, article, subscriber, codes=None): 'Priority': map_priority(article.get('priority'))} body = self.append_body_footer(article) - if article.get(EMBARGO): - embargo = '{}{}'.format('Embargo Content. Timestamp: ', - get_utc_schedule(article, EMBARGO).isoformat()) - body = embargo + body if article[ITEM_TYPE] == CONTENT_TYPE.TEXT: body = get_text(body, content='html') diff --git a/server/aap/publish/formatters/anpa_formatter.py b/server/aap/publish/formatters/anpa_formatter.py index bb979f7ff..e57245112 100644 --- a/server/aap/publish/formatters/anpa_formatter.py +++ b/server/aap/publish/formatters/anpa_formatter.py @@ -10,11 +10,10 @@ from copy import deepcopy from superdesk.publish.formatters import Formatter from .aap_formatter_common import map_priority, get_service_level -from apps.archive.common import get_utc_schedule import superdesk from superdesk.errors import FormatterError import datetime -from superdesk.metadata.item import ITEM_TYPE, CONTENT_TYPE, BYLINE, EMBARGO, FORMAT, FORMATS +from superdesk.metadata.item import ITEM_TYPE, CONTENT_TYPE, BYLINE, FORMAT, FORMATS from .field_mappers.locator_mapper import LocatorMapper from .field_mappers.slugline_mapper import SluglineMapper from apps.packages import TakesPackageService @@ -98,11 +97,6 @@ def format(self, article, subscriber, codes=None): anpa.append((b'\x20' + take_key) if len(take_key) > 0 else b'') anpa.append(b'\x0D\x0A') - if formatted_article.get(EMBARGO): - embargo = '{}{}\r\n'.format('Embargo Content. Timestamp: ', - get_utc_schedule(formatted_article, EMBARGO).isoformat()) - anpa.append(embargo.encode('ascii', 'replace')) - if formatted_article.get('ednote', '') != '': ednote = '{}\r\n'.format(to_ascii(formatted_article.get('ednote'))) anpa.append(ednote.encode('ascii', 'replace'))