Skip to content

Commit

Permalink
Squashed commit of the following:
Browse files Browse the repository at this point in the history
commit de356ef
Author: Roman <[email protected]>
Date:   Wed Nov 8 14:36:21 2023 +0100

    Formatting

commit aeee824
Author: Roman <[email protected]>
Date:   Wed Nov 8 14:32:57 2023 +0100

    Refactor the BookingType c.t. name to PrenotazioneType

commit 16ea81b
Author: Roman <[email protected]>
Date:   Thu Nov 2 16:48:42 2023 +0100

    Refactor upgrade

commit 1126308
Author: Roman <[email protected]>
Date:   Thu Nov 2 15:10:04 2023 +0100

    Refactor tests

commit ffb198f
Author: Roman <[email protected]>
Date:   Thu Nov 2 11:29:34 2023 +0100

    Fix <Prenotazione>.get_booking_type method

commit 592e4b3
Author: Roman <[email protected]>
Date:   Thu Nov 2 10:05:55 2023 +0100

    Fix

commit 22c1e4d
Author: Roman <[email protected]>
Date:   Thu Nov 2 09:50:11 2023 +0100

    Remove cosa_serve field from the Booking Folder

commit 354c4cb
Author: Roman <[email protected]>
Date:   Tue Oct 31 14:46:27 2023 +0100

    Fix booking duration type

commit 5ffc526
Merge: d3d4b34 7829bc6
Author: Roman <[email protected]>
Date:   Tue Oct 31 12:07:30 2023 +0100

    Merge branch 'develop' into booking_types_ct

commit d3d4b34
Author: Roman <[email protected]>
Date:   Tue Oct 31 11:49:43 2023 +0100

    Fix booking duration converison

commit 8ce51e6
Author: Roman <[email protected]>
Date:   Tue Oct 31 10:53:12 2023 +0100

    Fix booking types duration vocabulary values type

commit 34429b6
Author: Roman <[email protected]>
Date:   Tue Oct 31 10:39:48 2023 +0100

    Fix booking duration handling

commit 0af7e6e
Author: Roman <[email protected]>
Date:   Tue Oct 31 10:16:20 2023 +0100

    Fix BookingType profile

commit 142bb8d
Author: Roman <[email protected]>
Date:   Tue Oct 31 10:00:36 2023 +0100

    Hide gates

commit f748cd7
Author: Roman <[email protected]>
Date:   Fri Oct 27 17:49:34 2023 +0200

    Refactor the @@prenotazioni_context_state.get_booking_type_duration method

commit d1209e7
Author: Roman <[email protected]>
Date:   Thu Oct 26 15:10:41 2023 +0200

    Refactor

commit 8da8dea
Author: Roman <[email protected]>
Date:   Thu Oct 26 15:05:56 2023 +0200

    Refactor

commit 5aac9ce
Author: Roman <[email protected]>
Date:   Thu Oct 26 14:37:37 2023 +0200

    Fix typos

commit 190b0ca
Author: Roman <[email protected]>
Date:   Thu Oct 19 16:54:46 2023 +0200

    Initial implementation
  • Loading branch information
folix-01 committed Nov 8, 2023
1 parent 5738f12 commit 79889af
Show file tree
Hide file tree
Showing 42 changed files with 80 additions and 78 deletions.
2 changes: 1 addition & 1 deletion src/redturtle/prenotazioni/adapters/configure.zcml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
name="booking_time"
/>
<adapter
factory=".stringinterp.BookingTypeSubstitution"
factory=".stringinterp.PrenotazioneTypeSubstitution"
provides="plone.stringinterp.interfaces.IStringSubstitution"
for="*"
name="booking_type"
Expand Down
2 changes: 1 addition & 1 deletion src/redturtle/prenotazioni/adapters/stringinterp.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def safe_call(self):


@adapter(Interface)
class BookingTypeSubstitution(BaseSubstitution):
class PrenotazioneTypeSubstitution(BaseSubstitution):
category = _("Booking")
description = _("The booking type.")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
from redturtle.prenotazioni.adapters.conflict import IConflictManager
from redturtle.prenotazioni.adapters.slot import BaseSlot, ISlot
from redturtle.prenotazioni.config import PAUSE_PORTAL_TYPE, PAUSE_SLOT
from redturtle.prenotazioni.content.booking_type import BookingType
from redturtle.prenotazioni.content.pause import Pause
from redturtle.prenotazioni.content.prenotazione_type import PrenotazioneType
from redturtle.prenotazioni.utilities.dateutils import hm2DT, hm2seconds
from redturtle.prenotazioni.utilities.urls import urlify

Expand Down Expand Up @@ -833,7 +833,7 @@ def booking_type_durations(self):

def get_booking_type_duration(self, booking_type):
"""Return the seconds for this booking_type"""
if type(booking_type) is BookingType:
if type(booking_type) is PrenotazioneType:
return int(booking_type.duration) * 60

if type(booking_type) is str:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from redturtle.prenotazioni import _


class IBookingType(model.Schema):
class IPrenotazioneType(model.Schema):
"""Marker interface and Dexterity Python Schema for Prenotazione"""

duration = schema.Choice(
Expand All @@ -31,12 +31,12 @@ class IBookingType(model.Schema):
# description=_("gates_help", default="Put gates here (one per line)."),
# required=True,
# value_type=schema.Choice(
# vocabulary="redturtle.prenotazioni.VocBookingTypeGates"
# vocabulary="redturtle.prenotazioni.VocPrenotazioneTypeGates"
# ),
# default=[],
# )


@implementer(IBookingType)
class BookingType(Item):
@implementer(IPrenotazioneType)
class PrenotazioneType(Item):
""" """
8 changes: 5 additions & 3 deletions src/redturtle/prenotazioni/content/prenotazioni_folder.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
from redturtle.prenotazioni import _
from redturtle.prenotazioni.browser.widget import WeekTableOverridesFieldWidget
from redturtle.prenotazioni.config import DEFAULT_VISIBLE_BOOKING_FIELDS
from redturtle.prenotazioni.content.booking_type import BookingType
from redturtle.prenotazioni.content.prenotazione_type import PrenotazioneType
from redturtle.prenotazioni.content.validators import PauseValidator, checkOverrides

try:
Expand Down Expand Up @@ -723,5 +723,7 @@ def getFutureDays(self):
def getNotBeforeDays(self):
return self.notBeforeDays

def get_booking_types(self) -> Generator[BookingType, None, None]:
return self.listFolderContents(contentFilter={"portal_type": "BookingType"})
def get_booking_types(self) -> Generator[PrenotazioneType, None, None]:
return self.listFolderContents(
contentFilter={"portal_type": "PrenotazioneType"}
)
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ msgstr ""
msgid "Booking Folder"
msgstr ""

#: redturtle/prenotazioni/profiles/default/types/BookingType.xml
#: redturtle/prenotazioni/profiles/default/types/PrenotazioneType.xml
msgid "Booking Type"
msgstr ""

Expand Down Expand Up @@ -147,7 +147,7 @@ msgstr ""
msgid "Descrizione Agenda"
msgstr ""

#: redturtle/prenotazioni/profiles/default/types/BookingType.xml
#: redturtle/prenotazioni/profiles/default/types/PrenotazioneType.xml
#: redturtle/prenotazioni/profiles/default/types/Prenotazione.xml
#: redturtle/prenotazioni/profiles/default/types/PrenotazioniDay.xml
msgid "Edit"
Expand Down Expand Up @@ -483,7 +483,7 @@ msgstr ""
msgid "Used to add new contentrules"
msgstr ""

#: redturtle/prenotazioni/profiles/default/types/BookingType.xml
#: redturtle/prenotazioni/profiles/default/types/PrenotazioneType.xml
#: redturtle/prenotazioni/profiles/default/types/Prenotazione.xml
#: redturtle/prenotazioni/profiles/default/types/PrenotazioniDay.xml
msgid "View"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ msgstr "Prenotazioni"
msgid "Booking Folder"
msgstr "Cartella prenotazioni"

#: redturtle/prenotazioni/profiles/default/types/BookingType.xml
#: redturtle/prenotazioni/profiles/default/types/PrenotazioneType.xml
msgid "Booking Type"
msgstr "Tipologia Prenotazione"

Expand Down Expand Up @@ -150,7 +150,7 @@ msgstr "Elimina"
msgid "Descrizione Agenda"
msgstr "Descrizione Agenda"

#: redturtle/prenotazioni/profiles/default/types/BookingType.xml
#: redturtle/prenotazioni/profiles/default/types/PrenotazioneType.xml
#: redturtle/prenotazioni/profiles/default/types/Prenotazione.xml
#: redturtle/prenotazioni/profiles/default/types/PrenotazioniDay.xml
msgid "Edit"
Expand Down Expand Up @@ -486,7 +486,7 @@ msgstr "Tipologia di prenotazione sconosciuta '${booking_type}'."
msgid "Used to add new contentrules"
msgstr "Aggiunge una nuova contentrule"

#: redturtle/prenotazioni/profiles/default/types/BookingType.xml
#: redturtle/prenotazioni/profiles/default/types/PrenotazioneType.xml
#: redturtle/prenotazioni/profiles/default/types/Prenotazione.xml
#: redturtle/prenotazioni/profiles/default/types/PrenotazioniDay.xml
msgid "View"
Expand Down
6 changes: 3 additions & 3 deletions src/redturtle/prenotazioni/locales/redturtle.prenotazioni.pot
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ msgstr ""
msgid "Booking Folder"
msgstr ""

#: redturtle/prenotazioni/profiles/default/types/BookingType.xml
#: redturtle/prenotazioni/profiles/default/types/PrenotazioneType.xml
msgid "Booking Type"
msgstr ""

Expand Down Expand Up @@ -150,7 +150,7 @@ msgstr ""
msgid "Descrizione Agenda"
msgstr ""

#: redturtle/prenotazioni/profiles/default/types/BookingType.xml
#: redturtle/prenotazioni/profiles/default/types/PrenotazioneType.xml
#: redturtle/prenotazioni/profiles/default/types/Prenotazione.xml
#: redturtle/prenotazioni/profiles/default/types/PrenotazioniDay.xml
msgid "Edit"
Expand Down Expand Up @@ -486,7 +486,7 @@ msgstr ""
msgid "Used to add new contentrules"
msgstr ""

#: redturtle/prenotazioni/profiles/default/types/BookingType.xml
#: redturtle/prenotazioni/profiles/default/types/PrenotazioneType.xml
#: redturtle/prenotazioni/profiles/default/types/Prenotazione.xml
#: redturtle/prenotazioni/profiles/default/types/PrenotazioniDay.xml
msgid "View"
Expand Down
4 changes: 2 additions & 2 deletions src/redturtle/prenotazioni/permissions.zcml
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@
/>

<permission
id="redturtle.prenotazioni.AddBookingType"
title="redturtle.prenotazioni: Add BookingType"
id="redturtle.prenotazioni.AddPrenotazioneType"
title="redturtle.prenotazioni: Add PrenotazioneType"
/>

<permission
Expand Down
2 changes: 1 addition & 1 deletion src/redturtle/prenotazioni/profiles/default/rolemap.xml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
</permission>

<permission acquire="True"
name="redturtle.prenotazioni: Add BookingType"
name="redturtle.prenotazioni: Add PrenotazioneType"
>
<role name="Manager" />
<role name="Site Administrator" />
Expand Down
2 changes: 1 addition & 1 deletion src/redturtle/prenotazioni/profiles/default/types.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,6 @@
name="Prenotazione"
/>
<object meta_type="Dexterity FTI"
name="BookingType"
name="PrenotazioneType"
/>
</object>
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<object xmlns:i18n="http://xml.zope.org/namespaces/i18n"
meta_type="Dexterity FTI"
name="BookingType"
name="PrenotazioneType"
i18n:domain="redturtle.prenotazioni"
>

Expand All @@ -14,18 +14,18 @@
>Booking Type</property>

<property name="allow_discussion">False</property>
<property name="factory">BookingType</property>
<property name="factory">PrenotazioneType</property>
<property name="icon_expr" />
<property name="link_target" />

<!-- Hierarchy control -->
<property name="global_allow">False</property>
<!-- Schema, class and security -->
<property name="add_permission">redturtle.prenotazioni.AddBookingType</property>
<property name="klass">redturtle.prenotazioni.content.booking_type.BookingType</property>
<property name="add_permission">redturtle.prenotazioni.AddPrenotazioneType</property>
<property name="klass">redturtle.prenotazioni.content.prenotazione_type.PrenotazioneType</property>
<property name="model_file" />
<property name="model_source" />
<property name="schema">redturtle.prenotazioni.content.booking_type.IBookingType</property>
<property name="schema">redturtle.prenotazioni.content.prenotazione_type.IPrenotazioneType</property>

<!-- Enabled behaviors -->
<property name="behaviors"
Expand All @@ -42,7 +42,7 @@
</property>

<!-- View information -->
<property name="add_view_expr">string:${folder_url}/++add++BookingType</property>
<property name="add_view_expr">string:${folder_url}/++add++PrenotazioneType</property>
<property name="default_view">goto-prenotazioni</property>
<property name="default_view_fallback">False</property>
<property name="immediate_view">view</property>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<property name="filter_content_types">True</property>
<property name="allowed_content_types">
<element value="PrenotazioniYear" />
<element value="BookingType" />
<element value="PrenotazioneType" />
<!--
<element value="Document" />
<element value="File" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<adapter factory=".slot.SlotSerializer" />
<adapter factory=".prenotazione.PrenotazioneSerializer" />
<adapter factory=".prenotazione.PrenotazioneSearchableItemSerializer" />
<adapter factory=".booking_type.BookingTypeRetroCompatibleSerializer" />
<adapter factory=".prenotazione_type.PrenotazioneTypeRetroCompatibleSerializer" />
<adapter factory=".prenotazioni_folder.PrenotazioniFolderSerializer" />

</configure>
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
from zope.schema import getFields

from redturtle.prenotazioni import logger
from redturtle.prenotazioni.content.booking_type import IBookingType
from redturtle.prenotazioni.content.prenotazione import IPrenotazione
from redturtle.prenotazioni.content.prenotazione_type import IPrenotazioneType
from redturtle.prenotazioni.interfaces import ISerializeToPrenotazioneSearchableItem


Expand All @@ -27,7 +27,7 @@ def __call__(self, *args, **kwargs):
try:
requirements = getMultiAdapter(
(
getFields(IBookingType)["requirements"],
getFields(IPrenotazioneType)["requirements"],
self.prenotazione.get_booking_type(),
self.request,
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@
from zope.component import adapter
from zope.interface import implementer

from redturtle.prenotazioni.content.booking_type import IBookingType
from redturtle.prenotazioni.content.prenotazione_type import IPrenotazioneType
from redturtle.prenotazioni.interfaces import (
IRedturtlePrenotazioniLayer,
ISerializeToRetroCompatibleJson,
)


@implementer(ISerializeToRetroCompatibleJson)
@adapter(IBookingType, IRedturtlePrenotazioniLayer)
class BookingTypeRetroCompatibleSerializer:
"""BookingType c.t. serializer retrocompatible with earlier frontend implementation"""
@adapter(IPrenotazioneType, IRedturtlePrenotazioniLayer)
class PrenotazioneTypeRetroCompatibleSerializer:
"""PrenotazioneType c.t. serializer retrocompatible with earlier frontend implementation"""

def __init__(self, context, request):
self.context = context
Expand Down
2 changes: 1 addition & 1 deletion src/redturtle/prenotazioni/tests/test_add_block.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def setUp(self):
)

api.content.create(
type="BookingType",
type="PrenotazioneType",
title="Type A",
duration=30,
container=self.folder_prenotazioni,
Expand Down
6 changes: 3 additions & 3 deletions src/redturtle/prenotazioni/tests/test_add_booking.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ def setUp(self):
)

booking_type_A = api.content.create(
type="BookingType",
type="PrenotazioneType",
title="Type A",
duration=30,
container=self.folder_prenotazioni,
Expand Down Expand Up @@ -214,7 +214,7 @@ def test_cant_add_booking_if_missing_required_fields(self):
)

api.content.create(
type="BookingType",
type="PrenotazioneType",
title="Type A",
duration=30,
container=folder,
Expand Down Expand Up @@ -256,7 +256,7 @@ def setUp(self):
)

api.content.create(
type="BookingType",
type="PrenotazioneType",
title="Type A",
duration=30,
container=self.folder_prenotazioni,
Expand Down
6 changes: 3 additions & 3 deletions src/redturtle/prenotazioni/tests/test_available_slots.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,14 @@ def setUp(self):
)

api.content.create(
type="BookingType",
type="PrenotazioneType",
title="Type A",
duration=30,
container=self.folder_prenotazioni,
gates=["all"],
)
api.content.create(
type="BookingType",
type="PrenotazioneType",
title="Type B",
duration=90,
container=self.folder_prenotazioni,
Expand Down Expand Up @@ -312,7 +312,7 @@ def test_month_slots_notBeforeDays_honored(
)

api.content.create(
type="BookingType",
type="PrenotazioneType",
title="Type A",
duration=30,
container=folder,
Expand Down
2 changes: 1 addition & 1 deletion src/redturtle/prenotazioni/tests/test_booking_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ def setUp(self):
)

api.content.create(
type="BookingType",
type="PrenotazioneType",
title="Type A",
duration=30,
container=self.folder_prenotazioni,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def setUp(self):
)

api.content.create(
type="BookingType",
type="PrenotazioneType",
title="Type A",
duration=30,
container=self.folder_prenotazioni,
Expand Down
2 changes: 1 addition & 1 deletion src/redturtle/prenotazioni/tests/test_booking_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ def setUp(self):
)

api.content.create(
type="BookingType",
type="PrenotazioneType",
title="Type A",
duration=30,
container=self.folder_prenotazioni,
Expand Down
4 changes: 2 additions & 2 deletions src/redturtle/prenotazioni/tests/test_bookings_num_limit.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,14 @@ def setUp(self):
)

api.content.create(
type="BookingType",
type="PrenotazioneType",
title="Type A",
duration=30,
container=self.folder_prenotazioni,
gates=["all"],
)
api.content.create(
type="BookingType",
type="PrenotazioneType",
title="Type B",
duration=90,
container=self.folder_prenotazioni,
Expand Down
Loading

0 comments on commit 79889af

Please sign in to comment.