Skip to content

Commit

Permalink
Merge pull request #39 from RedTurtle/refactor_rest_service
Browse files Browse the repository at this point in the history
Refactor rest service to simplify inheritance
  • Loading branch information
luca-bellenghi authored Apr 22, 2024
2 parents 4512ac7 + f76f3c1 commit 730c5a5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
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

0 comments on commit 730c5a5

Please sign in to comment.