From a0fdb6c5009d65a2f56cf16aa3ce66bdedb1a4fa Mon Sep 17 00:00:00 2001 From: Daniele Andreotti Date: Wed, 31 Jul 2024 17:15:47 +0200 Subject: [PATCH 1/4] added controlpanel settings --- src/iosanita/policy/browser/__init__.py | 0 src/iosanita/policy/browser/configure.zcml | 20 ++++ src/iosanita/policy/browser/controlpanel.py | 17 ++++ src/iosanita/policy/configure.zcml | 1 + src/iosanita/policy/controlpanels/__init__.py | 0 src/iosanita/policy/controlpanels/settings.py | 94 +++++++++++++++++++ .../policy/profiles/default/controlpanel.xml | 20 ++++ .../profiles/default/registry/settings.xml | 16 ++++ .../policy/restapi/services/configure.zcml | 6 ++ .../policy/restapi/services/controlpanel.py | 18 ++++ .../policy/tests/test_controlpanel_api.py | 37 ++++++++ test_plone60.cfg | 22 +++++ 12 files changed, 251 insertions(+) create mode 100644 src/iosanita/policy/browser/__init__.py create mode 100644 src/iosanita/policy/browser/configure.zcml create mode 100644 src/iosanita/policy/browser/controlpanel.py create mode 100644 src/iosanita/policy/controlpanels/__init__.py create mode 100644 src/iosanita/policy/controlpanels/settings.py create mode 100644 src/iosanita/policy/profiles/default/controlpanel.xml create mode 100644 src/iosanita/policy/profiles/default/registry/settings.xml create mode 100644 src/iosanita/policy/restapi/services/controlpanel.py create mode 100644 src/iosanita/policy/tests/test_controlpanel_api.py diff --git a/src/iosanita/policy/browser/__init__.py b/src/iosanita/policy/browser/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/src/iosanita/policy/browser/configure.zcml b/src/iosanita/policy/browser/configure.zcml new file mode 100644 index 0000000..b3ed0e7 --- /dev/null +++ b/src/iosanita/policy/browser/configure.zcml @@ -0,0 +1,20 @@ + + + + + + + \ No newline at end of file diff --git a/src/iosanita/policy/browser/controlpanel.py b/src/iosanita/policy/browser/controlpanel.py new file mode 100644 index 0000000..8130fa2 --- /dev/null +++ b/src/iosanita/policy/browser/controlpanel.py @@ -0,0 +1,17 @@ +# -*- coding: utf-8 -*- +from plone.app.registry.browser.controlpanel import ControlPanelFormWrapper +from plone.app.registry.browser.controlpanel import RegistryEditForm +from iosanita.policy import _ +from iosanita.policy.controlpanels.settings import IIoSanitaSettings + + +class IoSanitaSettingsForm(RegistryEditForm): + schema = IIoSanitaSettings + id = "iosanita-settings" + label = _("IoSanita Settings") + + +class IoSanitaSettingsView(ControlPanelFormWrapper): + """ """ + + form = IoSanitaSettingsForm diff --git a/src/iosanita/policy/configure.zcml b/src/iosanita/policy/configure.zcml index be84805..615ed7e 100644 --- a/src/iosanita/policy/configure.zcml +++ b/src/iosanita/policy/configure.zcml @@ -14,6 +14,7 @@ --> + diff --git a/src/iosanita/policy/controlpanels/__init__.py b/src/iosanita/policy/controlpanels/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/src/iosanita/policy/controlpanels/settings.py b/src/iosanita/policy/controlpanels/settings.py new file mode 100644 index 0000000..966e3e8 --- /dev/null +++ b/src/iosanita/policy/controlpanels/settings.py @@ -0,0 +1,94 @@ +# -*- coding: utf-8 -*- +from iosanita.policy import _ +from plone.app.registry.browser.controlpanel import ControlPanelFormWrapper +from plone.app.registry.browser.controlpanel import RegistryEditForm +from plone.restapi.controlpanels.interfaces import IControlpanel +from zope.interface import Interface +from zope.schema import Bool +from zope.schema import List +from zope.schema import SourceText +from zope.schema import TextLine + + +class IoSanitaSettingsControlpanel(IControlpanel): + """ """ + + +class IIoSanitaSettings(Interface): + lead_image_dimension = List( + title=_( + "lead_image_dimension_label", + default="Dimensioni lead image", + ), + description=_( + "lead_image_dimension_help", + default="Se un content-type deve avere una dimensione della " + "leadimage particolare, indicarle qui. " + "Inserire le dimensioni nella forma di esempio " + "PortalType|900x900", + ), + required=True, + default=[ + "News Item|1920x600", + "Servizio|1920x600", + "UnitaOrganizzativa|1920x600", + "Persona|180x100", + ], + value_type=TextLine(), + ) + + search_sections = SourceText( + title=_("search_sections_label", default="Sezioni ricerca"), + description=_( + "search_sections_help", + default="Inserire una lista di sezioni per la ricerca.", + ), + default="", + required=False, + ) + + show_modified_default = Bool( + title=_("show_modified_default_label", default="Mostra la data di modifica"), + description=_( + "show_modified_default_help", + default="Questo è il valore di default per decidere se mostrare " + "o meno la data di modifica nei contenuti che hanno la behavior " + "abilitata. E' poi possibile sovrascrivere il default nei singoli " + 'contenuti (nel tab "Impostazioni").', + ), + default=True, + required=False, + ) + + show_dynamic_folders_in_footer = Bool( + title=_("show_dynamic_folders_in_footer_label", default="Footer dinamico"), + description=_( + "show_dynamic_folders_in_footer_help", + default="Se selezionato, il footer verrà popolato automaticamente " + "con i contenuti di primo livello non esclusi dalla navigazione.", + ), + default=True, + required=False, + ) + + contatti_testata = SourceText( + title=_("contatti_testata_label", default="Contatti in testata"), + description=_( + "contatti_testatas_help", + default="Inserire i contatti.", + ), + default="", + required=False, + ) + + +class IoSanitaControlPanelForm(RegistryEditForm): + schema = IIoSanitaSettings + id = "io-sanita-control-panel" + label = _("Impostazioni IoSanita") + + +class IoSanitaControlPanelView(ControlPanelFormWrapper): + """ """ + + form = IoSanitaControlPanelForm diff --git a/src/iosanita/policy/profiles/default/controlpanel.xml b/src/iosanita/policy/profiles/default/controlpanel.xml new file mode 100644 index 0000000..8a0e956 --- /dev/null +++ b/src/iosanita/policy/profiles/default/controlpanel.xml @@ -0,0 +1,20 @@ + + + + + Manage portal + + + \ No newline at end of file diff --git a/src/iosanita/policy/profiles/default/registry/settings.xml b/src/iosanita/policy/profiles/default/registry/settings.xml new file mode 100644 index 0000000..f992d52 --- /dev/null +++ b/src/iosanita/policy/profiles/default/registry/settings.xml @@ -0,0 +1,16 @@ + + + + + + + + gallery 250:65536 + + + diff --git a/src/iosanita/policy/restapi/services/configure.zcml b/src/iosanita/policy/restapi/services/configure.zcml index 3cb15f6..a0a4fbf 100644 --- a/src/iosanita/policy/restapi/services/configure.zcml +++ b/src/iosanita/policy/restapi/services/configure.zcml @@ -6,4 +6,10 @@ + + diff --git a/src/iosanita/policy/restapi/services/controlpanel.py b/src/iosanita/policy/restapi/services/controlpanel.py new file mode 100644 index 0000000..0ae36f1 --- /dev/null +++ b/src/iosanita/policy/restapi/services/controlpanel.py @@ -0,0 +1,18 @@ +# -*- coding: utf-8 -*- +from iosanita.policy.controlpanels.settings import IIoSanitaSettings +from iosanita.policy.controlpanels.settings import ( + IoSanitaSettingsControlpanel, +) +from plone.restapi.controlpanels import RegistryConfigletPanel +from zope.component import adapter +from zope.interface import implementer +from zope.interface import Interface + + +@adapter(Interface, Interface) +@implementer(IoSanitaSettingsControlpanel) +class IoSanitaSettings(RegistryConfigletPanel): + schema = IIoSanitaSettings + configlet_id = "IoSanitaSettings" + configlet_category_id = "Products" + schema_prefix = None diff --git a/src/iosanita/policy/tests/test_controlpanel_api.py b/src/iosanita/policy/tests/test_controlpanel_api.py new file mode 100644 index 0000000..78a8de3 --- /dev/null +++ b/src/iosanita/policy/tests/test_controlpanel_api.py @@ -0,0 +1,37 @@ +# -*- coding: utf-8 -*- +from iosanita.policy.testing import RESTAPI_TESTING +from plone import api +from plone.app.testing import setRoles +from plone.app.testing import SITE_OWNER_NAME +from plone.app.testing import SITE_OWNER_PASSWORD +from plone.app.testing import TEST_USER_ID +from plone.restapi.testing import RelativeSession + +import unittest + + +class ControlpanelTest(unittest.TestCase): + layer = RESTAPI_TESTING + + def setUp(self): + self.app = self.layer["app"] + self.portal = self.layer["portal"] + self.portal_url = self.portal.absolute_url() + + self.api_session = RelativeSession(self.portal_url) + self.api_session.headers.update({"Accept": "application/json"}) + self.api_session.auth = (SITE_OWNER_NAME, SITE_OWNER_PASSWORD) + + setRoles(self.portal, TEST_USER_ID, ["Manager"]) + + def test_controlpanel_exists(self): + response = self.api_session.get("/@controlpanels/iosanita-settings") + + self.assertEqual(response.status_code, 200) + self.assertEqual(response.headers.get("Content-Type"), "application/json") + + def test_controlpanel_listed(self): + response = self.api_session.get("/@controlpanels") + + titles = [x.get("title") for x in response.json()] + self.assertIn("IoSanita Settings", titles) diff --git a/test_plone60.cfg b/test_plone60.cfg index 5dbc994..69ea625 100644 --- a/test_plone60.cfg +++ b/test_plone60.cfg @@ -137,3 +137,25 @@ souper.plone = 1.3.1 # iosanita.policy==1.0.0.dev0 # redturtle.volto==5.5.0 z3c.jbot = 2.0 + +# Added by buildout at 2024-07-31 13:03:47.206767 + +# Required by: +# redturtle.bandi==1.4.5 +collective.tiles.collection = 2.1.1 + +# Required by: +# iosanita.policy==1.0.0.dev0 +collective.volto.slimheader = 1.0.1 + +# Required by: +# collective.tiles.collection==2.1.1 +plone.app.tiles = 4.0.1 + +# Required by: +# iosanita.contenttypes==2.0.0.dev0 +redturtle.bandi = 1.4.5 + +# Required by: +# check-manifest==0.49 +tomli = 2.0.1 From 1b610c8c093880d7ad02bd8c0e8b41a855ccd1c9 Mon Sep 17 00:00:00 2001 From: Daniele Andreotti Date: Wed, 31 Jul 2024 17:18:40 +0200 Subject: [PATCH 2/4] zpretty --- src/iosanita/policy/browser/configure.zcml | 2 +- src/iosanita/policy/tests/test_controlpanel_api.py | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/src/iosanita/policy/browser/configure.zcml b/src/iosanita/policy/browser/configure.zcml index b3ed0e7..19d740e 100644 --- a/src/iosanita/policy/browser/configure.zcml +++ b/src/iosanita/policy/browser/configure.zcml @@ -17,4 +17,4 @@ permission="cmf.ManagePortal" /> - \ No newline at end of file + diff --git a/src/iosanita/policy/tests/test_controlpanel_api.py b/src/iosanita/policy/tests/test_controlpanel_api.py index 78a8de3..a97255c 100644 --- a/src/iosanita/policy/tests/test_controlpanel_api.py +++ b/src/iosanita/policy/tests/test_controlpanel_api.py @@ -1,6 +1,5 @@ # -*- coding: utf-8 -*- from iosanita.policy.testing import RESTAPI_TESTING -from plone import api from plone.app.testing import setRoles from plone.app.testing import SITE_OWNER_NAME from plone.app.testing import SITE_OWNER_PASSWORD From c077e2e3922a589fe76aa12eb0a4f15565e47a11 Mon Sep 17 00:00:00 2001 From: Andrea Cecchi Date: Wed, 14 Aug 2024 17:10:33 +0200 Subject: [PATCH 3/4] refactored controlpanel --- src/iosanita/policy/browser/configure.zcml | 3 +- src/iosanita/policy/browser/controlpanel.py | 15 +-- src/iosanita/policy/controlpanels/__init__.py | 0 src/iosanita/policy/controlpanels/settings.py | 94 ------------------- src/iosanita/policy/interfaces.py | 86 ++++++++++++++++- .../policy/profiles/default/controlpanel.xml | 4 +- .../profiles/default/registry/settings.xml | 2 +- src/iosanita/policy/restapi/configure.zcml | 11 ++- .../policy/restapi/services/configure.zcml | 6 -- .../policy/restapi/services/controlpanel.py | 18 ---- .../policy/tests/test_controlpanel_api.py | 5 +- 11 files changed, 104 insertions(+), 140 deletions(-) delete mode 100644 src/iosanita/policy/controlpanels/__init__.py delete mode 100644 src/iosanita/policy/controlpanels/settings.py delete mode 100644 src/iosanita/policy/restapi/services/controlpanel.py diff --git a/src/iosanita/policy/browser/configure.zcml b/src/iosanita/policy/browser/configure.zcml index 19d740e..ae51cd2 100644 --- a/src/iosanita/policy/browser/configure.zcml +++ b/src/iosanita/policy/browser/configure.zcml @@ -13,8 +13,9 @@ diff --git a/src/iosanita/policy/browser/controlpanel.py b/src/iosanita/policy/browser/controlpanel.py index 8130fa2..80bc69a 100644 --- a/src/iosanita/policy/browser/controlpanel.py +++ b/src/iosanita/policy/browser/controlpanel.py @@ -1,17 +1,12 @@ -# -*- coding: utf-8 -*- -from plone.app.registry.browser.controlpanel import ControlPanelFormWrapper -from plone.app.registry.browser.controlpanel import RegistryEditForm from iosanita.policy import _ -from iosanita.policy.controlpanels.settings import IIoSanitaSettings +from iosanita.policy.interfaces import IIoSanitaSettings +from plone.app.registry.browser import controlpanel -class IoSanitaSettingsForm(RegistryEditForm): +class IoSanitaSettingsForm(controlpanel.RegistryEditForm): schema = IIoSanitaSettings - id = "iosanita-settings" - label = _("IoSanita Settings") + label = _("iosanita_settings_label", default="Io-Sanità Settings") -class IoSanitaSettingsView(ControlPanelFormWrapper): - """ """ - +class IoSanitaControlPanel(controlpanel.ControlPanelFormWrapper): form = IoSanitaSettingsForm diff --git a/src/iosanita/policy/controlpanels/__init__.py b/src/iosanita/policy/controlpanels/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/src/iosanita/policy/controlpanels/settings.py b/src/iosanita/policy/controlpanels/settings.py deleted file mode 100644 index 966e3e8..0000000 --- a/src/iosanita/policy/controlpanels/settings.py +++ /dev/null @@ -1,94 +0,0 @@ -# -*- coding: utf-8 -*- -from iosanita.policy import _ -from plone.app.registry.browser.controlpanel import ControlPanelFormWrapper -from plone.app.registry.browser.controlpanel import RegistryEditForm -from plone.restapi.controlpanels.interfaces import IControlpanel -from zope.interface import Interface -from zope.schema import Bool -from zope.schema import List -from zope.schema import SourceText -from zope.schema import TextLine - - -class IoSanitaSettingsControlpanel(IControlpanel): - """ """ - - -class IIoSanitaSettings(Interface): - lead_image_dimension = List( - title=_( - "lead_image_dimension_label", - default="Dimensioni lead image", - ), - description=_( - "lead_image_dimension_help", - default="Se un content-type deve avere una dimensione della " - "leadimage particolare, indicarle qui. " - "Inserire le dimensioni nella forma di esempio " - "PortalType|900x900", - ), - required=True, - default=[ - "News Item|1920x600", - "Servizio|1920x600", - "UnitaOrganizzativa|1920x600", - "Persona|180x100", - ], - value_type=TextLine(), - ) - - search_sections = SourceText( - title=_("search_sections_label", default="Sezioni ricerca"), - description=_( - "search_sections_help", - default="Inserire una lista di sezioni per la ricerca.", - ), - default="", - required=False, - ) - - show_modified_default = Bool( - title=_("show_modified_default_label", default="Mostra la data di modifica"), - description=_( - "show_modified_default_help", - default="Questo è il valore di default per decidere se mostrare " - "o meno la data di modifica nei contenuti che hanno la behavior " - "abilitata. E' poi possibile sovrascrivere il default nei singoli " - 'contenuti (nel tab "Impostazioni").', - ), - default=True, - required=False, - ) - - show_dynamic_folders_in_footer = Bool( - title=_("show_dynamic_folders_in_footer_label", default="Footer dinamico"), - description=_( - "show_dynamic_folders_in_footer_help", - default="Se selezionato, il footer verrà popolato automaticamente " - "con i contenuti di primo livello non esclusi dalla navigazione.", - ), - default=True, - required=False, - ) - - contatti_testata = SourceText( - title=_("contatti_testata_label", default="Contatti in testata"), - description=_( - "contatti_testatas_help", - default="Inserire i contatti.", - ), - default="", - required=False, - ) - - -class IoSanitaControlPanelForm(RegistryEditForm): - schema = IIoSanitaSettings - id = "io-sanita-control-panel" - label = _("Impostazioni IoSanita") - - -class IoSanitaControlPanelView(ControlPanelFormWrapper): - """ """ - - form = IoSanitaControlPanelForm diff --git a/src/iosanita/policy/interfaces.py b/src/iosanita/policy/interfaces.py index c1b6c69..b9a0136 100644 --- a/src/iosanita/policy/interfaces.py +++ b/src/iosanita/policy/interfaces.py @@ -1,8 +1,88 @@ -# -*- coding: utf-8 -*- -"""Module where all interfaces, events and exceptions live.""" - from zope.publisher.interfaces.browser import IDefaultBrowserLayer +from iosanita.policy import _ +from plone.restapi.controlpanels.interfaces import IControlpanel +from zope.interface import Interface +from zope.schema import Bool +from zope.schema import List +from zope.schema import SourceText +from zope.schema import TextLine class IIosanitaPolicyLayer(IDefaultBrowserLayer): """Marker interface that defines a browser layer.""" + + +class IIoSanitaSettingsControlpanel(IControlpanel): + """ """ + + +class IIoSanitaSettings(Interface): + """ + Control panel settings + """ + + lead_image_dimension = List( + title=_( + "lead_image_dimension_label", + default="Dimensioni lead image", + ), + description=_( + "lead_image_dimension_help", + default="Se un content-type deve avere una dimensione della " + "leadimage particolare, indicarle qui. " + "Inserire le dimensioni nella forma di esempio " + "PortalType|900x900", + ), + required=True, + default=[ + "News Item|1920x600", + "Servizio|1920x600", + "UnitaOrganizzativa|1920x600", + "Persona|180x100", + ], + value_type=TextLine(), + ) + + search_sections = SourceText( + title=_("search_sections_label", default="Sezioni ricerca"), + description=_( + "search_sections_help", + default="Inserire una lista di sezioni per la ricerca.", + ), + default="", + required=False, + ) + + show_modified_default = Bool( + title=_("show_modified_default_label", default="Mostra la data di modifica"), + description=_( + "show_modified_default_help", + default="Questo è il valore di default per decidere se mostrare " + "o meno la data di modifica nei contenuti che hanno la behavior " + "abilitata. E' poi possibile sovrascrivere il default nei singoli " + 'contenuti (nel tab "Impostazioni").', + ), + default=True, + required=False, + ) + + show_dynamic_folders_in_footer = Bool( + title=_("show_dynamic_folders_in_footer_label", default="Footer dinamico"), + description=_( + "show_dynamic_folders_in_footer_help", + default="Se selezionato, il footer verrà popolato automaticamente " + "con i contenuti di primo livello non esclusi dalla navigazione.", + ), + default=True, + required=False, + ) + + contatti_testata = SourceText( + title=_("contatti_testata_label", default="Contatti in testata"), + description=_( + "contatti_testatas_help", + default="Inserire i contatti.", + ), + default="", + required=False, + ) diff --git a/src/iosanita/policy/profiles/default/controlpanel.xml b/src/iosanita/policy/profiles/default/controlpanel.xml index 8a0e956..44e897d 100644 --- a/src/iosanita/policy/profiles/default/controlpanel.xml +++ b/src/iosanita/policy/profiles/default/controlpanel.xml @@ -5,7 +5,7 @@ > Manage portal - \ No newline at end of file + diff --git a/src/iosanita/policy/profiles/default/registry/settings.xml b/src/iosanita/policy/profiles/default/registry/settings.xml index f992d52..09632af 100644 --- a/src/iosanita/policy/profiles/default/registry/settings.xml +++ b/src/iosanita/policy/profiles/default/registry/settings.xml @@ -2,7 +2,7 @@ - + - + + + diff --git a/src/iosanita/policy/restapi/services/configure.zcml b/src/iosanita/policy/restapi/services/configure.zcml index a0a4fbf..3cb15f6 100644 --- a/src/iosanita/policy/restapi/services/configure.zcml +++ b/src/iosanita/policy/restapi/services/configure.zcml @@ -6,10 +6,4 @@ - - diff --git a/src/iosanita/policy/restapi/services/controlpanel.py b/src/iosanita/policy/restapi/services/controlpanel.py deleted file mode 100644 index 0ae36f1..0000000 --- a/src/iosanita/policy/restapi/services/controlpanel.py +++ /dev/null @@ -1,18 +0,0 @@ -# -*- coding: utf-8 -*- -from iosanita.policy.controlpanels.settings import IIoSanitaSettings -from iosanita.policy.controlpanels.settings import ( - IoSanitaSettingsControlpanel, -) -from plone.restapi.controlpanels import RegistryConfigletPanel -from zope.component import adapter -from zope.interface import implementer -from zope.interface import Interface - - -@adapter(Interface, Interface) -@implementer(IoSanitaSettingsControlpanel) -class IoSanitaSettings(RegistryConfigletPanel): - schema = IIoSanitaSettings - configlet_id = "IoSanitaSettings" - configlet_category_id = "Products" - schema_prefix = None diff --git a/src/iosanita/policy/tests/test_controlpanel_api.py b/src/iosanita/policy/tests/test_controlpanel_api.py index a97255c..44a22bb 100644 --- a/src/iosanita/policy/tests/test_controlpanel_api.py +++ b/src/iosanita/policy/tests/test_controlpanel_api.py @@ -26,6 +26,9 @@ def setUp(self): def test_controlpanel_exists(self): response = self.api_session.get("/@controlpanels/iosanita-settings") + import pdb + + pdb.set_trace() self.assertEqual(response.status_code, 200) self.assertEqual(response.headers.get("Content-Type"), "application/json") @@ -33,4 +36,4 @@ def test_controlpanel_listed(self): response = self.api_session.get("/@controlpanels") titles = [x.get("title") for x in response.json()] - self.assertIn("IoSanita Settings", titles) + self.assertIn("Impostazioni IoSanita", titles) From f79a3bbb54771c7c36f69774b2417db577f9394f Mon Sep 17 00:00:00 2001 From: Andrea Cecchi Date: Wed, 14 Aug 2024 17:11:00 +0200 Subject: [PATCH 4/4] code cleanup --- src/iosanita/policy/interfaces.py | 2 +- src/iosanita/policy/restapi/configure.zcml | 2 +- src/iosanita/policy/restapi/controlpanel.py | 16 ++++++++++++++++ src/iosanita/policy/testing.py | 2 +- 4 files changed, 19 insertions(+), 3 deletions(-) create mode 100644 src/iosanita/policy/restapi/controlpanel.py diff --git a/src/iosanita/policy/interfaces.py b/src/iosanita/policy/interfaces.py index b9a0136..a083340 100644 --- a/src/iosanita/policy/interfaces.py +++ b/src/iosanita/policy/interfaces.py @@ -1,7 +1,7 @@ -from zope.publisher.interfaces.browser import IDefaultBrowserLayer from iosanita.policy import _ from plone.restapi.controlpanels.interfaces import IControlpanel from zope.interface import Interface +from zope.publisher.interfaces.browser import IDefaultBrowserLayer from zope.schema import Bool from zope.schema import List from zope.schema import SourceText diff --git a/src/iosanita/policy/restapi/configure.zcml b/src/iosanita/policy/restapi/configure.zcml index 5408a6e..e4b3d68 100644 --- a/src/iosanita/policy/restapi/configure.zcml +++ b/src/iosanita/policy/restapi/configure.zcml @@ -3,7 +3,7 @@ xmlns:plone="http://namespaces.plone.org/plone" > - + diff --git a/src/iosanita/policy/restapi/controlpanel.py b/src/iosanita/policy/restapi/controlpanel.py new file mode 100644 index 0000000..f2b71bb --- /dev/null +++ b/src/iosanita/policy/restapi/controlpanel.py @@ -0,0 +1,16 @@ +from iosanita.policy.interfaces import IIosanitaPolicyLayer +from iosanita.policy.interfaces import IIoSanitaSettings +from iosanita.policy.interfaces import IIoSanitaSettingsControlpanel +from plone.restapi.controlpanels import RegistryConfigletPanel +from zope.component import adapter +from zope.interface import implementer +from zope.interface import Interface + + +@adapter(Interface, IIosanitaPolicyLayer) +@implementer(IIoSanitaSettingsControlpanel) +class IoSanitaSettingsControlpanel(RegistryConfigletPanel): + schema = IIoSanitaSettings + configlet_id = "IoSanitaSettings" + configlet_category_id = "Products" + schema_prefix = None diff --git a/src/iosanita/policy/testing.py b/src/iosanita/policy/testing.py index e2435cf..04b37da 100644 --- a/src/iosanita/policy/testing.py +++ b/src/iosanita/policy/testing.py @@ -11,8 +11,8 @@ import collective.volto.slimheader import iosanita.contenttypes import iosanita.policy -import souper.plone import plone.app.caching +import souper.plone class TestLayer(ContentTypesTestLayer):