From f19c7abe001e14bb209f9e00a64a01860a5dc659 Mon Sep 17 00:00:00 2001 From: Luca Bellenghi Date: Fri, 12 Apr 2024 09:32:45 +0200 Subject: [PATCH] Refactor rest service to simplify inheritance --- CHANGES.rst | 3 ++- .../plone/ioprenoto/restapi/services/bookable_list/get.py | 7 +++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/CHANGES.rst b/CHANGES.rst index 25bc892..e58b437 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -4,7 +4,8 @@ Changelog 1.2.5 (unreleased) ------------------ -- Nothing changed yet. +- Refactor rest service to simplify inheritance + [lucabel] 1.2.4 (2024-04-11) 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 e252a40..604179b 100644 --- a/src/design/plone/ioprenoto/restapi/services/bookable_list/get.py +++ b/src/design/plone/ioprenoto/restapi/services/bookable_list/get.py @@ -4,8 +4,8 @@ from plone.restapi.interfaces import ISerializeToJsonSummary from plone.restapi.serializer.converters import json_compatible from plone.restapi.services import Service -from urllib.parse import urlencode from urllib.parse import unquote +from urllib.parse import urlencode from zc.relation.interfaces import ICatalog from zope.component import getMultiAdapter from zope.component import getUtility @@ -104,6 +104,9 @@ def get_uo_from_service_uid(self, uid): class BookableUOList(BookableList): + + UO_CONTENT_TYPE = "UnitaOrganizzativa" + def booking_type_check(self, prenotazioni_folder, booking_type): if not booking_type: return True @@ -135,7 +138,7 @@ def reply(self): "@id": f"{self.context.absolute_url()}/@bookable-uo-list", "items": [], } - query = dict(portal_type="UnitaOrganizzativa", sort_on="sortable_title") + query = dict(portal_type=self.UO_CONTENT_TYPE, sort_on="sortable_title") uid = self.request.form.get("uid", "") booking_type = self.request.form.get("booking_type", "") if uid: