From f1961f8da3917445c507fe0fdad5db448f55632f Mon Sep 17 00:00:00 2001 From: marwoodandrew Date: Fri, 5 Jul 2019 13:30:22 +1000 Subject: [PATCH 1/4] 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 From ffe78c77a611336a10a559e170ea3c62cb5ef8f8 Mon Sep 17 00:00:00 2001 From: marwoodandrew Date: Thu, 4 Jul 2019 16:54:38 +1000 Subject: [PATCH 2/4] fix(pollution macro) retry requests --- server/aap/macros/pollution_report.py | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/server/aap/macros/pollution_report.py b/server/aap/macros/pollution_report.py index 6d519fedb..3a5d71d4b 100644 --- a/server/aap/macros/pollution_report.py +++ b/server/aap/macros/pollution_report.py @@ -49,7 +49,16 @@ def generate_pollution_story(item, **kwargs): # the regional value or just the site value, regional value rows seem to also contain a site value AQI # The results are stored into the values map url = 'https://airquality.environment.nsw.gov.au/aquisnetnswphp/getPage.php?reportid=1' - page = requests.get(url) + tries = 0 + while tries < 5: + try: + page = requests.get(url, timeout=5, verify=False, allow_redirects=True) + break + except Exception as ex: + logger.exception(ex) + tries += 1 + if tries == 5: + raise ex tree = html.fromstring(page.content) rows = tree.xpath('/html/body/table[2]/tbody/tr') for row in rows: @@ -82,8 +91,17 @@ def generate_pollution_story(item, **kwargs): # Attempt to extract the forecast from the page below url = 'https://airquality.environment.nsw.gov.au/aquisnetnswphp/getPage.php?reportid=9' - page = requests.get(url) - tree = html.fromstring(page.content) + tries = 0 + while tries < 5: + try: + forecast_page = requests.get(url, timeout=5, verify=False, allow_redirects=True) + break + except Exception as ex: + logger.exception(ex) + tries += 1 + if tries == 5: + raise ex + tree = html.fromstring(forecast_page.content) # Extract the value values_map['sydney_forecast'] = str(tree.xpath('/html/body/center/table/tbody/tr[1]/td/p/b/text()')[0]) # Get the day that the forecast is for From 401e1663275b179fa2d3505cd85e8572054865e9 Mon Sep 17 00:00:00 2001 From: "nrvikas@gmail.com" Date: Thu, 4 Jul 2019 12:09:57 +1000 Subject: [PATCH 3/4] [SDESK-4436] Template for downloading events for courts listing added entry to planning_export_templates data file --- server/data/planning_export_templates.json | 30 ++++++++++++++------- server/templates/event_courts_download.html | 2 ++ 2 files changed, 23 insertions(+), 9 deletions(-) create mode 100644 server/templates/event_courts_download.html diff --git a/server/data/planning_export_templates.json b/server/data/planning_export_templates.json index 5b647b41c..9413385b1 100644 --- a/server/data/planning_export_templates.json +++ b/server/data/planning_export_templates.json @@ -1,10 +1,22 @@ -[{ - "_id" : "planning_outlook", - "name" : "outlook", - "type" : "planning", - "data" : { - "slugline" : "Outlook", - "body_html_template" : "outlook_planning_template.html" +[ + { + "_id" : "planning_outlook", + "name" : "outlook", + "type" : "planning", + "data" : { + "slugline" : "Outlook", + "body_html_template" : "outlook_planning_template.html" + }, + "label" : "Outlook" }, - "label" : "Outlook" -}] + { + "_id" : "event_courts_download", + "name" : "event_courts_download", + "type" : "event", + "data" : { + "template_file" : "event_courts_download.html" + }, + "label" : "Courts", + "download" : true + } +] diff --git a/server/templates/event_courts_download.html b/server/templates/event_courts_download.html new file mode 100644 index 000000000..4600281d3 --- /dev/null +++ b/server/templates/event_courts_download.html @@ -0,0 +1,2 @@ +{% for item in items %}{{ item['dates']['start'].strftime('%H%M') }} - {{ item['name'] }}.{% if (item.get('location') or [])|length > 0 %}{% for l in item.location %} {{ l.name }}{% endfor %}{% endif %} +{% endfor %} \ No newline at end of file From cbdb3e18f6556766a7a029730e200d438675bfbc Mon Sep 17 00:00:00 2001 From: Mark Pittaway Date: Tue, 9 Jul 2019 12:50:14 +1000 Subject: [PATCH 4/4] Updating cores for UAT Release v1.29.3-RC2 --- CHANGELOG.md | 30 +++++++++++++++++++++++++++++- client/package.json | 2 +- server/requirements.txt | 2 +- setup.py | 2 +- 4 files changed, 32 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8f718c306..1110fadab 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,34 @@ -## [unreleased] +## [1.29.3] NOT RELEASE YET +### Superdesk Change Log +#### Added +- [SDESK-4436] Template for downloading events for courts listing +#### Fixed +- fix(pollution macro) retry requests +- fix(abs macro) upate item when exected on stage macro + +### Superdesk Planning Change Log +#### Added +- [SDESK-4063] Add loader animation on file upload +- [SDESK-4400] Time in Event exports are in UTC instead of server timezone +- [SDESK-4329] Show coverage type in palnning widget coverage details +- [SDESK-4307] Locations Management enhancements +- [SDESK-4375] Show 'genre' in assignments list view +- [SDESK-4377] Make ed-note editable in add-to-planning modal +- [SDBELGA-108] Add unused templates at the end of recent event templates list. +- [SDBELGA-108] List all recent event templates is 'limit' query param was not provided. +- [SDBELGA-108] Store event related data as subdict in event templates schema. +- [SDBELGA-108] Event temlates API. +- [SDESK-4368] Publish time in delivery record is not taking content item's publish schedule into account + +#### Fixed +- (fix) Limit pydocstyle < 4.0 +- [SDESK-4453] Coverage schedule time for published or scheduled news item should be derived from the news item +- [SDESK-4451] sequence_no in delivery record was null instead of 0 by default +- [SDESK-4410] Location from an event was not getting deleted +- [SDESK-4410] Bug when setting time for Coverage Schedule Date +- [SDESK-4414] Locking linked updated news story was locking the assignment ## [0.1] - 2015-09-04 diff --git a/client/package.json b/client/package.json index 50efa8b10..d250509d4 100644 --- a/client/package.json +++ b/client/package.json @@ -3,7 +3,7 @@ "license": "GPL-3.0", "dependencies": { "superdesk-core": "superdesk/superdesk-client-core#7b86cf5", - "superdesk-planning": "superdesk/superdesk-planning#a82b642", + "superdesk-planning": "superdesk/superdesk-planning#687122f", "superdesk-analytics": "superdesk/superdesk-analytics#e4188fd" } } diff --git a/server/requirements.txt b/server/requirements.txt index 12adecb79..0c820634f 100644 --- a/server/requirements.txt +++ b/server/requirements.txt @@ -14,5 +14,5 @@ oauth2client==4.1.3 requests<2.22 git+git://github.com/superdesk/superdesk-core.git@93ac7cb#egg=Superdesk-Core -git+git://github.com/superdesk/superdesk-planning.git@a82b642#egg=superdesk-planning +git+git://github.com/superdesk/superdesk-planning.git@687122f#egg=superdesk-planning git+git://github.com/superdesk/superdesk-analytics.git@e4188fd#egg=superdesk-analytics diff --git a/setup.py b/setup.py index 0321b9661..e69297f5a 100644 --- a/setup.py +++ b/setup.py @@ -22,7 +22,7 @@ setup( name='Superdesk-Server', - version='0.1.3-dev', + version='1.29.3-rc2', description='Superdesk REST API server', long_description=LONG_DESCRIPTION, author='petr jasek',