From 65e38377352abae41323137d5cf26d0f42f8cf4e Mon Sep 17 00:00:00 2001 From: Petr Date: Thu, 3 Nov 2016 11:37:47 +0100 Subject: [PATCH] fix(publish): allow email formatter it was disabled by default SD-305 --- apps/prepopulate/data_init/vocabularies.json | 17 ++++++++++++++--- apps/publish/enqueue/enqueue_service.py | 4 ++-- superdesk/publish/formatters/email_formatter.py | 6 +++--- 3 files changed, 19 insertions(+), 8 deletions(-) diff --git a/apps/prepopulate/data_init/vocabularies.json b/apps/prepopulate/data_init/vocabularies.json index 18155524dc..cdeaf57322 100644 --- a/apps/prepopulate/data_init/vocabularies.json +++ b/apps/prepopulate/data_init/vocabularies.json @@ -128,11 +128,22 @@ "type": "unmanageable", "items": [ {"is_active": true, "name": "All", "qcode": "all", - "formats": [{"name": "NINJS", "qcode": "ninjs"}, {"name": "NewsML G2", "qcode": "newsmlg2"}]}, + "formats": [ + {"name": "NINJS", "qcode": "ninjs"}, + {"name": "NewsML G2", "qcode": "newsmlg2"}, + {"name": "Email", "qcode": "email"} + ]}, {"is_active": true, "name": "Digital/Internet", "qcode": "digital", - "formats": [{"name": "NINJS", "qcode": "ninjs"}, {"name": "NewsML G2", "qcode": "newsmlg2"}]}, + "formats": [ + {"name": "NINJS", "qcode": "ninjs"}, + {"name": "NewsML G2", "qcode": "newsmlg2"}, + {"name": "Email", "qcode": "email"} + ]}, {"is_active": true, "name": "Wire/Paper", "qcode": "wire", - "formats": [{"name": "NITF", "qcode": "nitf"}]} + "formats": [ + {"name": "NITF", "qcode": "nitf"}, + {"name": "Email", "qcode": "email"} + ]} ] }, { diff --git a/apps/publish/enqueue/enqueue_service.py b/apps/publish/enqueue/enqueue_service.py index 87b4ec0a1d..c154b49292 100644 --- a/apps/publish/enqueue/enqueue_service.py +++ b/apps/publish/enqueue/enqueue_service.py @@ -209,8 +209,8 @@ def publish(self, doc, target_media_type=None): # Step 6 if not target_media_type and not queued: - logger.exception('Nothing is saved to publish queue for story: {} for action: {}'. - format(doc[config.ID_FIELD], self.publish_type)) + logger.error('Nothing is saved to publish queue for story: {} for action: {}'. + format(doc[config.ID_FIELD], self.publish_type)) return queued diff --git a/superdesk/publish/formatters/email_formatter.py b/superdesk/publish/formatters/email_formatter.py index ba6365af26..55fc006fc1 100644 --- a/superdesk/publish/formatters/email_formatter.py +++ b/superdesk/publish/formatters/email_formatter.py @@ -8,14 +8,14 @@ # AUTHORS and LICENSE files distributed with this source code, or # at https://www.sourcefabric.org/superdesk/license +import json +import superdesk from superdesk.publish.formatters import Formatter from superdesk.metadata.item import ITEM_TYPE, CONTENT_TYPE, FORMAT, FORMATS from flask import render_template -import superdesk from copy import deepcopy from bs4 import BeautifulSoup, NavigableString from superdesk.errors import FormatterError -import json class EmailFormatter(Formatter): @@ -62,4 +62,4 @@ def format(self, article, subscriber, codes=None): return [(pub_seq_num, json.dumps(doc))] def can_format(self, format_type, article): - return format_type == 'Email' and article[ITEM_TYPE] == CONTENT_TYPE.TEXT + return format_type.lower() == 'email' and article[ITEM_TYPE] == CONTENT_TYPE.TEXT