Skip to content

Commit

Permalink
Merge pull request #265 from marwoodandrew/sdesk-998
Browse files Browse the repository at this point in the history
[SDESK-998] Remove the embargo processing from the AAP formatters
  • Loading branch information
Mayur Dhamanwala authored Mar 31, 2017
2 parents 7d2e63e + aa2dac5 commit f9bb09f
Show file tree
Hide file tree
Showing 5 changed files with 2 additions and 28 deletions.
1 change: 0 additions & 1 deletion server/aap/publish/formatters/aap_ipnews_formatter.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
1 change: 0 additions & 1 deletion server/aap/publish/formatters/aap_newscentre_formatter.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
13 changes: 0 additions & 13 deletions server/aap/publish/formatters/aap_odbc_formatter.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
7 changes: 1 addition & 6 deletions server/aap/publish/formatters/aap_sms_formatter.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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')
Expand Down
8 changes: 1 addition & 7 deletions server/aap/publish/formatters/anpa_formatter.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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'))
Expand Down

0 comments on commit f9bb09f

Please sign in to comment.