From e2f68511c53a2c7cfb2d3908905ab7e259ea1280 Mon Sep 17 00:00:00 2001 From: Mayur Dhamanwala Date: Tue, 23 Aug 2016 14:13:14 +1000 Subject: [PATCH] fix(formatter) Set the versioncreated to current date for schedule item. --- .../publish/formatters/aap_bulletinbuilder_formatter.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/server/aap/publish/formatters/aap_bulletinbuilder_formatter.py b/server/aap/publish/formatters/aap_bulletinbuilder_formatter.py index eeff8aa8a..ef32c468f 100644 --- a/server/aap/publish/formatters/aap_bulletinbuilder_formatter.py +++ b/server/aap/publish/formatters/aap_bulletinbuilder_formatter.py @@ -13,8 +13,9 @@ import re from eve.utils import config from superdesk.utils import json_serialize_datetime_objectId +from superdesk.utc import utcnow from superdesk.errors import FormatterError -from superdesk.metadata.item import ITEM_TYPE, PACKAGE_TYPE +from superdesk.metadata.item import ITEM_TYPE, PACKAGE_TYPE, ITEM_STATE, CONTENT_STATE from bs4 import BeautifulSoup from .field_mappers.locator_mapper import LocatorMapper from .field_mappers.slugline_mapper import SluglineMapper @@ -50,6 +51,10 @@ def format(self, article, subscriber, codes=None): if 'new zealand' in desk_name.lower().strip(): formatted_article['source'] = 'NZN' + # this is temporary fix for bulletin builder formatter + if formatted_article.get(ITEM_STATE, '') == CONTENT_STATE.SCHEDULED: + formatted_article['versioncreated'] = utcnow() + formatted_article['body_text'] = self.get_text_content(body_html) formatted_article['abstract'] = self.get_text_content( to_ascii(formatted_article.get('abstract', '') or '')).strip()