Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions news/URB-3702.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Add cron4plone instruction for notice import
Switch NOTICe API default URL to production
[daggelpop]
2 changes: 1 addition & 1 deletion src/Products/urban/browser/notice_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class INoticeSettings(Interface):
url = schema.URI(
title=_("Webservice URL"),
required=True,
default="https://api-staging.imio.be/spw/notice/v1/",
default="https://api.imio.be/spw/notice/v1/",
)

municipality_id = schema.TextLine(
Expand Down
17 changes: 17 additions & 0 deletions src/Products/urban/migration/update_290.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from textwrap import dedent

from Products.CMFCore.utils import getToolByName
from Products.cron4plone.browser.configlets.cron_configuration import ICronConfiguration
from Products.urban import URBAN_TYPES
from Products.urban import UrbanMessage as _
from Products.urban.contentrules.notice import INoticeImportFailedEvent
Expand All @@ -20,6 +21,7 @@
from plone.registry import Record
from plone.registry.interfaces import IRegistry
from zope.component import getUtility
from zope.component import queryUtility
from zope.event import notify

import logging
Expand Down Expand Up @@ -643,3 +645,18 @@ def normalize_externaldecisions_vocabulary(context):
new_term = getattr(voc_folder, vocabulary_term)
new_term.setDescription(DESCRIPTION)
logger.info("Created missing vocabulary term: %s", vocabulary_term)


def setup_cron4plone_notice_import(context):
logger = logging.getLogger("urban: Setup cron4plone notice import")

cron_cfg = queryUtility(
ICronConfiguration, name="cron4plone_config", context=api.portal.get()
)

line_to_add = u"0 * * * portal/@@import-from-notice"
if line_to_add not in cron_cfg.cronjobs:
new_list = list(cron_cfg.cronjobs) + [line_to_add]
cron_cfg.cronjobs = new_list

logger.info("upgrade step done!")
8 changes: 8 additions & 0 deletions src/Products/urban/migration/upgrades_290.zcml
Original file line number Diff line number Diff line change
Expand Up @@ -140,4 +140,12 @@
handler=".update_290.normalize_externaldecisions_vocabulary"
profile="Products.urban:default" />

<gs:upgradeStep
title="Setup cron4plone notice import"
description=""
source="2917"
destination="2918"
handler=".update_290.setup_cron4plone_notice_import"
profile="Products.urban:default" />

</configure>
2 changes: 1 addition & 1 deletion src/Products/urban/profiles/default/metadata.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0"?>
<metadata>
<version>2916</version>
<version>2918</version>
<dependencies>
<dependency>profile-Products.urban:preinstall</dependency>
</dependencies>
Expand Down
1 change: 1 addition & 0 deletions src/Products/urban/setuphandlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,7 @@ def addDefaultCronJobs(context):
u"0 1 * * portal/@@mailings",
u"0 2 * * portal/@@inquiry_radius",
u"0 4 * * portal/@@claimants_import",
u"0 * * * portal/@@import-from-notice",
]


Expand Down