diff --git a/.gitignore b/.gitignore index 621053834..45cf971a5 100644 --- a/.gitignore +++ b/.gitignore @@ -31,3 +31,4 @@ include/ /server/.settings/org.eclipse.core.resources.prefs /results/ /superdesk-content-api/ +/node_modules/ \ No newline at end of file diff --git a/server/aap/macros/generate_slugline_story_by_desk.py b/server/aap/macros/generate_slugline_story_by_desk.py index 9704288d3..d9b1b99ca 100644 --- a/server/aap/macros/generate_slugline_story_by_desk.py +++ b/server/aap/macros/generate_slugline_story_by_desk.py @@ -46,12 +46,17 @@ def get_articles(self, query, repo): def create_query(self): raise NotImplementedError() + @abstractmethod + def process(self): + raise NotImplementedError() + def generate(self, template_name): query, repo = self.create_query() articles = self.get_articles(query, repo) if not articles: return '' + self.process(articles) return render_template(template_name, items=articles) @@ -113,6 +118,14 @@ def create_query(self): return query, ['archive', 'published'] + def process(self, articles): + for article in articles: + article['anpa_take_key'] = article.get('anpa_take_key') or '' + article['abstract'] = article.get('abstract') or '' + article['slugline'] = article.get('slugline') or '' + article['source'] = article.get('source') or '' + article['dateline_city'] = (article.get('dateline', {}).get('located', {}).get('city') or '').upper() + def generate_published_slugline_story_by_desk(item, **kwargs): """ diff --git a/server/settings.py b/server/settings.py index 711b24560..f9e2da9aa 100644 --- a/server/settings.py +++ b/server/settings.py @@ -186,3 +186,4 @@ def env(variable, fallback_value=None): is_testing = os.environ.get('SUPERDESK_TESTING', '').lower() == 'true' ELASTICSEARCH_FORCE_REFRESH = is_testing ELASTICSEARCH_AUTO_AGGREGATIONS = False +CUSTOM_TEMPLATE_PATH = [os.path.join(ABS_PATH, 'templates')] diff --git a/server/templates/skeds_body_html.html b/server/templates/skeds_body_html.html new file mode 100644 index 000000000..a40ac4235 --- /dev/null +++ b/server/templates/skeds_body_html.html @@ -0,0 +1,3 @@ +{% for item in items %} +

{{item.dateline_city}} {{item.source}} - {{item.abstract|striptags}} ({{item.slugline}}) {{item.anpa_take_key}} {{item.versioncreated | format_datetime('Australia/Sydney', '%H:%S')}}


+{% endfor %} \ No newline at end of file