From f1961f8da3917445c507fe0fdad5db448f55632f Mon Sep 17 00:00:00 2001 From: marwoodandrew Date: Fri, 5 Jul 2019 13:30:22 +1000 Subject: [PATCH] fix(abs macro) upate item when exected on stage macro --- server/aap/macros/abs_indicators.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/server/aap/macros/abs_indicators.py b/server/aap/macros/abs_indicators.py index d7d92893b..4ffbb1543 100644 --- a/server/aap/macros/abs_indicators.py +++ b/server/aap/macros/abs_indicators.py @@ -15,6 +15,8 @@ import time import logging from flask import render_template_string +from superdesk import get_resource_service +from superdesk.utils import config cpi_url = 'CPI/2.50.999901.20.Q' cpi_token = '__CPI__' @@ -136,6 +138,15 @@ def abs_expand(item, **kwargs): except Exception as ex: logger.warning(ex) + # If the macro is being executed by a stage macro then update the item directly + if 'desk' in kwargs and 'stage' in kwargs: + update = {'body_html': item.get('body_html', ''), + 'abstract': item.get('abstract', ''), + 'headline': item.get('headline', '')} + get_resource_service('archive').system_update(item[config.ID_FIELD], update, item) + + return get_resource_service('archive').find_one(req=None, _id=item[config.ID_FIELD]) + return item