--- 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,