Updated form prefix
authorThierry Florac <thierry.florac@onf.fr>
Fri, 27 Apr 2018 17:13:54 +0200
changeset 82 fb2eed8dc88e
parent 81 17f00e31a7b0
child 83 f80aa497b4d7
Updated form prefix
src/pyams_portal/zmi/layout.py
src/pyams_portal/zmi/portlet.py
src/pyams_portal/zmi/templates/portlet.pt
--- a/src/pyams_portal/zmi/layout.py	Fri Apr 27 17:13:43 2018 +0200
+++ b/src/pyams_portal/zmi/layout.py	Fri Apr 27 17:13:54 2018 +0200
@@ -471,7 +471,7 @@
     def __call__(self):
         request = self.request
         request.registry.notify(PageletCreatedEvent(self))
-        portlet_id = int(request.params.get('portlet.widgets.portlet_id'))
+        portlet_id = int(request.params.get('{0}widgets.portlet_id'.format(self.prefix)))
         portlet_config = IPortalPortletsConfiguration(self.context).get_portlet_configuration(portlet_id)
         if portlet_config is None:
             raise NotFound()
@@ -494,7 +494,7 @@
         request = self.request
         request.registry.notify(PageletCreatedEvent(self))
         # load portlet config
-        portlet_id = int(request.params.get('portlet.widgets.portlet_id'))
+        portlet_id = int(request.params.get('{0}widgets.portlet_id'.format(self.prefix)))
         portlet_config = IPortalPortletsConfiguration(self.context).get_portlet_configuration(portlet_id)
         if portlet_config is None:
             raise NotFound()
--- a/src/pyams_portal/zmi/portlet.py	Fri Apr 27 17:13:43 2018 +0200
+++ b/src/pyams_portal/zmi/portlet.py	Fri Apr 27 17:13:54 2018 +0200
@@ -17,7 +17,7 @@
 
 # import interfaces
 from pyams_form.interfaces.form import IInnerTabForm
-from pyams_portal.interfaces import IPortlet, IPortalTemplate, IPortalPage, IPortalContext, MANAGE_TEMPLATE_PERMISSION
+from pyams_portal.interfaces import IPortlet, IPortalTemplate, IPortalPage, MANAGE_TEMPLATE_PERMISSION
 from pyams_skin.layer import IPyAMSLayer
 
 # import packages
@@ -36,7 +36,7 @@
 class PortletSettingsEditor(AdminDialogEditForm):
     """Portlet settings edit form"""
 
-    prefix = 'portlet_properties.'
+    prefix = 'portlet.'
 
     @property
     def title(self):
--- a/src/pyams_portal/zmi/templates/portlet.pt	Fri Apr 27 17:13:43 2018 +0200
+++ b/src/pyams_portal/zmi/templates/portlet.pt	Fri Apr 27 17:13:54 2018 +0200
@@ -52,7 +52,7 @@
 							  tal:define="configuration view.configuration;
 										  can_inherit configuration.can_inherit;"
 							  tal:omit-tag="not can_inherit">
-						<input type="hidden" name="form.widgets.portlet_id"
+						<input type="hidden" name="portlet.widgets.portlet_id"
 							   tal:attributes="value configuration.portlet_id" />
 						<legend tal:condition="can_inherit"
 								class="inner checker"