# HG changeset patch # User Thierry Florac # Date 1606148428 -3600 # Node ID e4b77545c2f140b0cc5d18aecf770005b03257a8 # Parent 5b2885cf720fa80d288d0764a909929daebbd93e Small internal updates in portlet settings form diff -r 5b2885cf720f -r e4b77545c2f1 src/pyams_portal/zmi/layout.py --- a/src/pyams_portal/zmi/layout.py Wed Sep 02 17:22:47 2020 +0200 +++ b/src/pyams_portal/zmi/layout.py Mon Nov 23 17:20:28 2020 +0100 @@ -527,29 +527,33 @@ portlet_config.inherit_parent = False else: portlet_config.inherit_parent = True + # update settings changed_override = portlet_config.inherit_parent != old_override - # update settings - editor = request.registry.queryMultiAdapter((portlet_config.editor_settings, request), - IPagelet, name='properties.json') - if editor is None: - raise NotFound() - changes = editor() - # clear portlets cache on settings update + if changed_override: + translate = self.request.localizer.translate + changes = { + 'status': 'success', + 'message': translate(self.successMessage) + } + else: + # get edit output + editor = request.registry.queryMultiAdapter((portlet_config.editor_settings, request), + IPagelet, name='properties.json') + if editor is None: + raise NotFound() + changes = editor() if changes: + # clear portlets cache on settings update portlets_cache = get_cache(PORTLETS_CACHE_REGION, PORTLETS_CACHE_NAME) portlets_cache.clear() - # get edit output - translate = self.request.localizer.translate - if changed_override or changes: # we commit before loading previewer to avoid BLOBs "uncommitted changes" error ITransactionManager(self.context).commit() - previewer = request.registry.queryMultiAdapter((self.context, request, self, portlet_config.settings), + previewer = request.registry.queryMultiAdapter((self.context, request, self, + portlet_config.settings), IPortletPreviewer) if previewer is not None: previewer.update() changes.update({ - 'status': 'success', - 'message': translate(self.successMessage), 'callback': 'PyAMS_portal.template.editPortletCallback', 'options': { 'portlet_id': portlet_id,