Skip to content

Commit

Permalink
fix(publish): allow email formatter
Browse files Browse the repository at this point in the history
it was disabled by default

SD-305
  • Loading branch information
petrjasek committed Nov 3, 2016
1 parent d5ce0b9 commit 65e3837
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 8 deletions.
17 changes: 14 additions & 3 deletions apps/prepopulate/data_init/vocabularies.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"}
]}
]
},
{
Expand Down
4 changes: 2 additions & 2 deletions apps/publish/enqueue/enqueue_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
6 changes: 3 additions & 3 deletions superdesk/publish/formatters/email_formatter.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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

0 comments on commit 65e3837

Please sign in to comment.