Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor rest service to simplify inheritance #39

Merged
merged 2 commits into from
Apr 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ Changelog
1.2.5 (unreleased)
------------------

- Refactor rest service to simplify inheritance
[lucabel]
- Add redturtle.prenotazioni's notify_upcoming_bookings script to console_scripts (allows it to be available in the buildout).
[folix-01]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down
Loading