diff --git a/CHANGES.rst b/CHANGES.rst index 3d4ae07..35c223f 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -1,14 +1,37 @@ Changelog ========= -1.1.8 (unreleased) ------------------- +1.1.11 (unreleased) +------------------- - Compatibilize with the 2.0.1 redturtle.prenotazioni version. - Add the UO.contact_info field to @bookable-uo-list response. [folix-01] +1.1.10 (2023-10-16) +------------------- + +- Inherit redturtle.prenotazioni browser layer. + [folix-01] + + +1.1.9 (2023-10-13) +------------------ + +- Compatibilize with the 2.1.3redturtle.prenotazioni version. + [folix-01] + + +1.1.8 (2023-10-13) +------------------ + +- Update redturtle.prenotazioni version to >= 2.1.1 + [folix-01] +- Add the UO.contact_info field to @bookable-uo-list response. + [folix-01] + + 1.1.7 (2023-09-25) ------------------ diff --git a/setup.py b/setup.py index 3874a36..2effbf2 100644 --- a/setup.py +++ b/setup.py @@ -16,7 +16,7 @@ setup( name="design.plone.ioprenoto", - version="1.1.8.dev0", + version="1.1.11.dev0", description="An add-on for Plone", long_description=long_description, # Get more from https://pypi.org/classifiers/ diff --git a/src/design/plone/ioprenoto/__init__.py b/src/design/plone/ioprenoto/__init__.py index 9e164b5..15bc66e 100644 --- a/src/design/plone/ioprenoto/__init__.py +++ b/src/design/plone/ioprenoto/__init__.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- """Init and utils.""" -from zope.i18nmessageid import MessageFactory from redturtle.prenotazioni import config +from zope.i18nmessageid import MessageFactory _ = MessageFactory("design.plone.ioprenoto") diff --git a/src/design/plone/ioprenoto/adapters/stringinterp.py b/src/design/plone/ioprenoto/adapters/stringinterp.py index dde71b2..e0f46ee 100644 --- a/src/design/plone/ioprenoto/adapters/stringinterp.py +++ b/src/design/plone/ioprenoto/adapters/stringinterp.py @@ -3,8 +3,7 @@ from plone.registry.interfaces import IRegistry from plone.volto.interfaces import IVoltoSettings from redturtle.prenotazioni.adapters import stringinterp as base -from zope.component import adapter -from zope.component import getUtility +from zope.component import adapter, getUtility from zope.interface import Interface diff --git a/src/design/plone/ioprenoto/behaviors/additional_fields.py b/src/design/plone/ioprenoto/behaviors/additional_fields.py index 892ef80..e1e00c6 100644 --- a/src/design/plone/ioprenoto/behaviors/additional_fields.py +++ b/src/design/plone/ioprenoto/behaviors/additional_fields.py @@ -1,13 +1,13 @@ -from design.plone.ioprenoto import _ -from plone.autoform.interfaces import IFormFieldProvider -from plone.app.z3cform.widget import RelatedItemsFieldWidget from plone.app.vocabularies.catalog import CatalogSource -from plone.supermodel import model +from plone.app.z3cform.widget import RelatedItemsFieldWidget from plone.autoform import directives +from plone.autoform.interfaces import IFormFieldProvider +from plone.supermodel import model +from z3c.relationfield.schema import RelationChoice, RelationList from zope.interface import provider from zope.schema import Text -from z3c.relationfield.schema import RelationChoice -from z3c.relationfield.schema import RelationList + +from design.plone.ioprenoto import _ @provider(IFormFieldProvider) diff --git a/src/design/plone/ioprenoto/interfaces.py b/src/design/plone/ioprenoto/interfaces.py index e2ff17c..fe2fd60 100644 --- a/src/design/plone/ioprenoto/interfaces.py +++ b/src/design/plone/ioprenoto/interfaces.py @@ -1,8 +1,8 @@ # -*- coding: utf-8 -*- """Module where all interfaces, events and exceptions live.""" -from zope.publisher.interfaces.browser import IDefaultBrowserLayer +from redturtle.prenotazioni.interfaces import IRedturtlePrenotazioniLayer -class IDesignPloneIoprenotoLayer(IDefaultBrowserLayer): +class IDesignPloneIoprenotoLayer(IRedturtlePrenotazioniLayer): """Marker interface that defines a browser layer.""" diff --git a/src/design/plone/ioprenoto/locales/update.py b/src/design/plone/ioprenoto/locales/update.py index 69cda63..d6b86d9 100644 --- a/src/design/plone/ioprenoto/locales/update.py +++ b/src/design/plone/ioprenoto/locales/update.py @@ -1,9 +1,9 @@ # -*- coding: utf-8 -*- import os -import pkg_resources import subprocess +import pkg_resources domain = "design.plone.ioprenoto" os.chdir(pkg_resources.resource_filename(domain, "")) diff --git a/src/design/plone/ioprenoto/restapi/serializers/ovverrides/prenotazioniFolder.py b/src/design/plone/ioprenoto/restapi/serializers/ovverrides/prenotazioniFolder.py index c55adb8..cefd3e6 100644 --- a/src/design/plone/ioprenoto/restapi/serializers/ovverrides/prenotazioniFolder.py +++ b/src/design/plone/ioprenoto/restapi/serializers/ovverrides/prenotazioniFolder.py @@ -1,18 +1,15 @@ -from design.plone.ioprenoto.interfaces import IDesignPloneIoprenotoLayer -from design.plone.ioprenoto import PRENOTAZIONI_MANAGE_PERMISSION from plone import api -from plone.restapi.interfaces import ISerializeToJson -from plone.restapi.interfaces import ISerializeToJsonSummary +from plone.restapi.interfaces import ISerializeToJson, ISerializeToJsonSummary from plone.restapi.serializer.summary import DefaultJSONSummarySerializer -from redturtle.prenotazioni.content.prenotazioni_folder import ( - IPrenotazioniFolder, -) +from redturtle.prenotazioni.content.prenotazioni_folder import IPrenotazioniFolder from redturtle.prenotazioni.restapi.serializers.adapters.prenotazioni_folder import ( PrenotazioniFolderSerializer, ) from zope.component import adapter from zope.interface import implementer +from design.plone.ioprenoto import PRENOTAZIONI_MANAGE_PERMISSION +from design.plone.ioprenoto.interfaces import IDesignPloneIoprenotoLayer # TODO: move to registry PRENOTAZIONE_APPUNTAMENTO_ADDRESS = "prenotazione-appuntamenti-uffici" diff --git a/src/design/plone/ioprenoto/restapi/serializers/ovverrides/servizio.py b/src/design/plone/ioprenoto/restapi/serializers/ovverrides/servizio.py index 1dc57e4..f7f4f99 100644 --- a/src/design/plone/ioprenoto/restapi/serializers/ovverrides/servizio.py +++ b/src/design/plone/ioprenoto/restapi/serializers/ovverrides/servizio.py @@ -3,16 +3,14 @@ from design.plone.contenttypes.restapi.serializers.servizio import ( SerializeServizioToJsonSummary as ServizioSummaryOriginal, ) -from design.plone.ioprenoto.interfaces import IDesignPloneIoprenotoLayer -from plone.restapi.interfaces import ISerializeToJson -from plone.restapi.interfaces import ISerializeToJsonSummary +from plone.restapi.interfaces import ISerializeToJson, ISerializeToJsonSummary from plone.restapi.serializer.dxcontent import SerializeFolderToJson from zc.relation.interfaces import ICatalog -from zope.component import adapter -from zope.component import getUtility +from zope.component import adapter, getUtility from zope.interface import implementer -from zope.intid.interfaces import IIntIds -from zope.intid.interfaces import IntIdMissingError +from zope.intid.interfaces import IIntIds, IntIdMissingError + +from design.plone.ioprenoto.interfaces import IDesignPloneIoprenotoLayer def has_backreferences(service): diff --git a/src/design/plone/ioprenoto/restapi/services/bookable_list/get.py b/src/design/plone/ioprenoto/restapi/services/bookable_list/get.py index 2ef54da..6214e6e 100644 --- a/src/design/plone/ioprenoto/restapi/services/bookable_list/get.py +++ b/src/design/plone/ioprenoto/restapi/services/bookable_list/get.py @@ -4,11 +4,11 @@ from plone import api from plone.restapi.interfaces import ISerializeToJsonSummary +from plone.restapi.serializer.converters import json_compatible from plone.restapi.services import Service from zc.relation.interfaces import ICatalog from zope.component import getMultiAdapter, getUtility from zope.intid.interfaces import IIntIds -from plone.restapi.serializer.converters import json_compatible logger = getLogger(__name__) diff --git a/src/design/plone/ioprenoto/restapi/services/bookings/search.py b/src/design/plone/ioprenoto/restapi/services/bookings/search.py index 211646f..33974e3 100644 --- a/src/design/plone/ioprenoto/restapi/services/bookings/search.py +++ b/src/design/plone/ioprenoto/restapi/services/bookings/search.py @@ -1,13 +1,16 @@ # -*- coding: utf-8 -*- from plone import api -from design.plone.ioprenoto import PRENOTAZIONI_MANAGE_PERMISSION -from redturtle.prenotazioni.restapi.services.bookings.search import ( +from redturtle.prenotazioni.restapi.services.bookings.search import ( # noqa: E501 BookingsSearch as BookingsSearchBase, +) +from redturtle.prenotazioni.restapi.services.bookings.search import ( BookingsSearchFolder as BookingsSearchFolderBase, -) # noqa: E501 +) from zope.interface import implementer from zope.publisher.interfaces import IPublishTraverse +from design.plone.ioprenoto import PRENOTAZIONI_MANAGE_PERMISSION + # TODO: in alternativa si poteva sovrascrivere il serializer @implementer(IPublishTraverse) diff --git a/src/design/plone/ioprenoto/testing.py b/src/design/plone/ioprenoto/testing.py index 76901e5..22fd188 100644 --- a/src/design/plone/ioprenoto/testing.py +++ b/src/design/plone/ioprenoto/testing.py @@ -1,15 +1,14 @@ # -*- coding: utf-8 -*- -from design.plone.policy.testing import DesignPlonePolicyRestApiLayer -from design.plone.policy.testing import DesignPlonePolicyLayer -from plone.app.testing import applyProfile -from plone.app.testing import FunctionalTesting -from plone.app.testing import IntegrationTesting +import collective.contentrules.mailfromfield +import redturtle.prenotazioni +from design.plone.policy.testing import ( + DesignPlonePolicyLayer, + DesignPlonePolicyRestApiLayer, +) +from plone.app.testing import FunctionalTesting, IntegrationTesting, applyProfile from plone.testing import z2 - import design.plone.ioprenoto -import redturtle.prenotazioni -import collective.contentrules.mailfromfield try: import design.plone.iocittadino diff --git a/src/design/plone/ioprenoto/tests/test_PrenotazioniFolder_ct.py b/src/design/plone/ioprenoto/tests/test_PrenotazioniFolder_ct.py index 5b55807..e816df5 100644 --- a/src/design/plone/ioprenoto/tests/test_PrenotazioniFolder_ct.py +++ b/src/design/plone/ioprenoto/tests/test_PrenotazioniFolder_ct.py @@ -1,11 +1,11 @@ # -*- coding: utf-8 -*- -from design.plone.ioprenoto.testing import DESIGN_PLONE_IOPRENOTO_INTEGRATION_TESTING +import unittest + from plone import api -from plone.app.testing import setRoles -from plone.app.testing import TEST_USER_ID +from plone.app.testing import TEST_USER_ID, setRoles -import unittest +from design.plone.ioprenoto.testing import DESIGN_PLONE_IOPRENOTO_INTEGRATION_TESTING class TestPrenotazioniFolder(unittest.TestCase): diff --git a/src/design/plone/ioprenoto/tests/test_custom_booking_schema.py b/src/design/plone/ioprenoto/tests/test_custom_booking_schema.py index 1cbac2b..a61170b 100644 --- a/src/design/plone/ioprenoto/tests/test_custom_booking_schema.py +++ b/src/design/plone/ioprenoto/tests/test_custom_booking_schema.py @@ -1,6 +1,8 @@ # -*- coding: utf-8 -*- +import unittest from datetime import date -from design.plone.ioprenoto.testing import DESIGN_PLONE_IOPRENOTO_API_FUNCTIONAL_TESTING + +import transaction from plone import api from plone.app.testing import ( SITE_OWNER_NAME, @@ -8,11 +10,10 @@ TEST_USER_ID, setRoles, ) -from plone.restapi.testing import RelativeSession from plone.restapi.serializer.converters import json_compatible +from plone.restapi.testing import RelativeSession -import unittest -import transaction +from design.plone.ioprenoto.testing import DESIGN_PLONE_IOPRENOTO_API_FUNCTIONAL_TESTING class TestBookingSchema(unittest.TestCase): diff --git a/src/design/plone/ioprenoto/tests/test_custom_required_fields.py b/src/design/plone/ioprenoto/tests/test_custom_required_fields.py index ff3f2dc..c525a1d 100644 --- a/src/design/plone/ioprenoto/tests/test_custom_required_fields.py +++ b/src/design/plone/ioprenoto/tests/test_custom_required_fields.py @@ -1,12 +1,11 @@ # -*- coding: utf-8 -*- -from design.plone.ioprenoto.testing import DESIGN_PLONE_IOPRENOTO_FUNCTIONAL_TESTING -from plone.app.testing import setRoles -from plone.app.testing import TEST_USER_ID +import unittest + +from plone.app.testing import TEST_USER_ID, setRoles from zope.component import getUtility from zope.schema.interfaces import IVocabularyFactory - -import unittest +from design.plone.ioprenoto.testing import DESIGN_PLONE_IOPRENOTO_FUNCTIONAL_TESTING class CustomRequiredFieldsTest(unittest.TestCase): diff --git a/src/design/plone/ioprenoto/tests/test_prenotazione_add.py b/src/design/plone/ioprenoto/tests/test_prenotazione_add.py index 77773c1..d239c74 100644 --- a/src/design/plone/ioprenoto/tests/test_prenotazione_add.py +++ b/src/design/plone/ioprenoto/tests/test_prenotazione_add.py @@ -1,16 +1,12 @@ # -*- coding: utf-8 -*- -from datetime import date -from datetime import timedelta -from plone import api -from plone.app.testing import setRoles -from plone.app.testing import TEST_USER_ID -from plone.restapi.testing import RelativeSession -from redturtle.prenotazioni.testing import ( - REDTURTLE_PRENOTAZIONI_API_FUNCTIONAL_TESTING, -) - import unittest +from datetime import date, timedelta + import transaction +from plone import api +from plone.app.testing import TEST_USER_ID, setRoles +from plone.restapi.testing import RelativeSession +from redturtle.prenotazioni.testing import REDTURTLE_PRENOTAZIONI_API_FUNCTIONAL_TESTING class TestPrenotazioniRestAPIAdd(unittest.TestCase): diff --git a/src/design/plone/ioprenoto/tests/test_restapi_serializers_ovverrides_prenotazioni_folder.py b/src/design/plone/ioprenoto/tests/test_restapi_serializers_ovverrides_prenotazioni_folder.py index 4129c3f..4ef0369 100644 --- a/src/design/plone/ioprenoto/tests/test_restapi_serializers_ovverrides_prenotazioni_folder.py +++ b/src/design/plone/ioprenoto/tests/test_restapi_serializers_ovverrides_prenotazioni_folder.py @@ -1,14 +1,12 @@ # -*- coding: utf-8 -*- -from design.plone.ioprenoto.testing import DESIGN_PLONE_IOPRENOTO_API_FUNCTIONAL_TESTING +import unittest + from plone import api -from plone.app.testing import setRoles -from plone.app.testing import TEST_USER_ID -from plone.app.testing import TEST_USER_NAME -from plone.app.testing import TEST_USER_PASSWORD +from plone.app.testing import TEST_USER_ID, TEST_USER_NAME, TEST_USER_PASSWORD, setRoles from plone.restapi.testing import RelativeSession from transaction import commit -import unittest +from design.plone.ioprenoto.testing import DESIGN_PLONE_IOPRENOTO_API_FUNCTIONAL_TESTING class SummarySerializerTest(unittest.TestCase): diff --git a/src/design/plone/ioprenoto/tests/test_restapi_serializers_ovverrides_serzvizio.py b/src/design/plone/ioprenoto/tests/test_restapi_serializers_ovverrides_serzvizio.py index a44777a..b8798c5 100644 --- a/src/design/plone/ioprenoto/tests/test_restapi_serializers_ovverrides_serzvizio.py +++ b/src/design/plone/ioprenoto/tests/test_restapi_serializers_ovverrides_serzvizio.py @@ -1,10 +1,13 @@ # -*- coding: utf-8 -*- -from design.plone.ioprenoto.testing import DESIGN_PLONE_IOPRENOTO_API_FUNCTIONAL_TESTING +import unittest + 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.app.testing import ( + SITE_OWNER_NAME, + SITE_OWNER_PASSWORD, + TEST_USER_ID, + setRoles, +) from plone.restapi.testing import RelativeSession from transaction import commit from z3c.relationfield.relation import RelationValue @@ -13,7 +16,7 @@ from zope.intid.interfaces import IIntIds from zope.lifecycleevent import ObjectModifiedEvent -import unittest +from design.plone.ioprenoto.testing import DESIGN_PLONE_IOPRENOTO_API_FUNCTIONAL_TESTING class SummarySerializerTest(unittest.TestCase): diff --git a/src/design/plone/ioprenoto/tests/test_restapi_service_bookable_list.py b/src/design/plone/ioprenoto/tests/test_restapi_service_bookable_list.py index 0789cca..e422fab 100644 --- a/src/design/plone/ioprenoto/tests/test_restapi_service_bookable_list.py +++ b/src/design/plone/ioprenoto/tests/test_restapi_service_bookable_list.py @@ -1,20 +1,22 @@ # -*- coding: utf-8 -*- -from design.plone.ioprenoto.testing import DESIGN_PLONE_IOPRENOTO_API_FUNCTIONAL_TESTING +import unittest + 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.app.testing import ( + SITE_OWNER_NAME, + SITE_OWNER_PASSWORD, + TEST_USER_ID, + setRoles, +) +from plone.app.textfield.value import RichTextValue from plone.restapi.interfaces import ISerializeToJsonSummary from plone.restapi.testing import RelativeSession from transaction import commit from z3c.relationfield.relation import RelationValue -from zope.component import getMultiAdapter -from zope.component import queryUtility +from zope.component import getMultiAdapter, queryUtility from zope.intid.interfaces import IIntIds -from plone.app.textfield.value import RichTextValue -import unittest +from design.plone.ioprenoto.testing import DESIGN_PLONE_IOPRENOTO_API_FUNCTIONAL_TESTING class BookableUOListTest(unittest.TestCase): diff --git a/src/design/plone/ioprenoto/tests/test_setup.py b/src/design/plone/ioprenoto/tests/test_setup.py index 9e18530..198c8e8 100644 --- a/src/design/plone/ioprenoto/tests/test_setup.py +++ b/src/design/plone/ioprenoto/tests/test_setup.py @@ -1,14 +1,13 @@ # -*- coding: utf-8 -*- """Setup tests for this package.""" +import unittest + +from plone import api +from plone.app.testing import TEST_USER_ID, setRoles + from design.plone.ioprenoto.testing import ( # noqa: E501 DESIGN_PLONE_IOPRENOTO_INTEGRATION_TESTING, ) -from plone import api -from plone.app.testing import setRoles -from plone.app.testing import TEST_USER_ID - -import unittest - try: from Products.CMFPlone.utils import get_installer @@ -35,9 +34,10 @@ def test_product_installed(self): def test_browserlayer(self): """Test that IDesignPloneIoprenotoLayer is registered.""" - from design.plone.ioprenoto.interfaces import IDesignPloneIoprenotoLayer from plone.browserlayer import utils + from design.plone.ioprenoto.interfaces import IDesignPloneIoprenotoLayer + self.assertIn(IDesignPloneIoprenotoLayer, utils.registered_layers()) @@ -61,7 +61,8 @@ def test_product_uninstalled(self): def test_browserlayer_removed(self): """Test that IDesignPloneIoprenotoLayer is removed.""" - from design.plone.ioprenoto.interfaces import IDesignPloneIoprenotoLayer from plone.browserlayer import utils + from design.plone.ioprenoto.interfaces import IDesignPloneIoprenotoLayer + self.assertNotIn(IDesignPloneIoprenotoLayer, utils.registered_layers()) diff --git a/src/design/plone/ioprenoto/tests/test_stringinterp_overrides.py b/src/design/plone/ioprenoto/tests/test_stringinterp_overrides.py index a213481..ce6aea4 100644 --- a/src/design/plone/ioprenoto/tests/test_stringinterp_overrides.py +++ b/src/design/plone/ioprenoto/tests/test_stringinterp_overrides.py @@ -1,24 +1,17 @@ # -*- coding: utf-8 -*- -from datetime import date +import unittest +from datetime import date, datetime + +import transaction from plone import api -from plone.app.testing import ( - TEST_USER_ID, - setRoles, -) -from design.plone.ioprenoto.testing import ( - DESIGN_PLONE_IOPRENOTO_FUNCTIONAL_TESTING, -) -from datetime import datetime +from plone.app.testing import TEST_USER_ID, setRoles from plone.registry.interfaces import IRegistry -from plone.stringinterp.interfaces import IStringSubstitution -from plone.stringinterp.interfaces import IContextWrapper +from plone.stringinterp.interfaces import IContextWrapper, IStringSubstitution from plone.volto.interfaces import IVoltoSettings from redturtle.prenotazioni.adapters.booker import IBooker -from zope.component import getAdapter -from zope.component import getUtility +from zope.component import getAdapter, getUtility -import unittest -import transaction +from design.plone.ioprenoto.testing import DESIGN_PLONE_IOPRENOTO_FUNCTIONAL_TESTING class TestStringinterpOverrides(unittest.TestCase): diff --git a/src/design/plone/ioprenoto/upgrades/upgrades.py b/src/design/plone/ioprenoto/upgrades/upgrades.py index da663fa..eb08618 100644 --- a/src/design/plone/ioprenoto/upgrades/upgrades.py +++ b/src/design/plone/ioprenoto/upgrades/upgrades.py @@ -1,8 +1,8 @@ # -*- coding: utf-8 -*- -from plone import api - import logging +from plone import api + logger = logging.getLogger(__name__) DEFAULT_PROFILE = "profile-design.plone.ioprenoto:default"