From 8e80d1fb4fa4e1b21f969294081b08d7ab5d7c2f Mon Sep 17 00:00:00 2001 From: Filippo Campi Date: Thu, 5 Sep 2024 12:24:30 +0200 Subject: [PATCH] some minor fix on block form --- CHANGES.rst | 4 +++- .../patches/collective_volto_formsupport.py | 6 ++++-- src/design/plone/policy/tests/test_setup.py | 15 ++++++++------- 3 files changed, 15 insertions(+), 10 deletions(-) diff --git a/CHANGES.rst b/CHANGES.rst index eb7c3f5..ba5c5b0 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -4,7 +4,9 @@ Changelog 5.0.11 (unreleased) ------------------- -- Nothing changed yet. +- fixed translate on form block patch +- fixed check on saved value + [eikichi18] 5.0.10 (2024-09-04) diff --git a/src/design/plone/policy/patches/collective_volto_formsupport.py b/src/design/plone/policy/patches/collective_volto_formsupport.py index 0558c55..98cc2a8 100644 --- a/src/design/plone/policy/patches/collective_volto_formsupport.py +++ b/src/design/plone/policy/patches/collective_volto_formsupport.py @@ -141,7 +141,7 @@ def reply(self): message = translate( _( "save_data_exception", - default="Unable to save data. Value not unique: '${fields}'", + default="Impossibile salvare i dati. I campi '${fields}' non sono univoci.", # noqa mapping={"fields": e.args[0]}, ), context=self.request, @@ -225,7 +225,9 @@ def add(self, data): for saved_record in saved_data: unique = False for key in keys: - if record.attrs.storage[key[0]] != saved_record.attrs.storage[key[0]]: + if record.attrs.storage[key[0]] != saved_record.attrs.storage.get( + key[0], None + ): unique = True break diff --git a/src/design/plone/policy/tests/test_setup.py b/src/design/plone/policy/tests/test_setup.py index 7c25d22..c06d60d 100644 --- a/src/design/plone/policy/tests/test_setup.py +++ b/src/design/plone/policy/tests/test_setup.py @@ -1,18 +1,21 @@ # -*- coding: utf-8 -*- """Setup tests for this package.""" -import unittest - +from design.plone.policy.testing import DESIGN_PLONE_POLICY_INTEGRATION_TESTING from design.plone.policy.testing import ( - DESIGN_PLONE_POLICY_INTEGRATION_TESTING, DESIGN_PLONE_POLICY_LIMIT_ROOT_ADDABLES_INTEGRATION_TESTING, ) from plone import api -from plone.app.testing import TEST_USER_ID, setRoles +from plone.app.testing import setRoles +from plone.app.testing import TEST_USER_ID from plone.registry.interfaces import IRegistry -from Products.CMFPlone.interfaces import ISearchSchema, ISiteSchema +from Products.CMFPlone.interfaces import ISearchSchema +from Products.CMFPlone.interfaces import ISiteSchema from Products.CMFPlone.interfaces.controlpanel import INavigationSchema from zope.component import getUtility +import unittest + + try: from Products.CMFPlone.utils import get_installer except ImportError: @@ -107,7 +110,6 @@ def test_browserlayer_removed(self): class TestSetupLimitRootAddables(unittest.TestCase): - layer = DESIGN_PLONE_POLICY_LIMIT_ROOT_ADDABLES_INTEGRATION_TESTING def setUp(self): @@ -129,7 +131,6 @@ def test_setup(self): class TestUninstallLimitRootAddables(unittest.TestCase): - layer = DESIGN_PLONE_POLICY_INTEGRATION_TESTING def setUp(self):