org.views.reservation ===================== .. py:module:: org.views.reservation Functions --------- .. autoapisummary:: org.views.reservation.assert_anonymous_access_only_temporary org.views.reservation.assert_access_only_if_there_are_reservations org.views.reservation.respond_with_success org.views.reservation.respond_with_error org.views.reservation.reserve_allocation org.views.reservation.delete_reservation org.views.reservation.get_reservation_form_class org.views.reservation.handle_reservation_form org.views.reservation.get_next_resource_context org.views.reservation.handle_find_your_spot_reservation_form org.views.reservation.blocked_by_zipcode org.views.reservation.confirm_reservation org.views.reservation.finalize_reservation org.views.reservation.accept_reservation org.views.reservation.accept_reservation_from_ticket org.views.reservation.accept_reservation_with_message org.views.reservation.accept_reservation_with_message_from_ticket org.views.reservation.reject_reservation org.views.reservation.reject_reservation_from_ticket org.views.reservation.reject_reservation_with_message org.views.reservation.reject_reservation_with_message_from_ticket Module Contents --------------- .. py:function:: assert_anonymous_access_only_temporary(resource: onegov.reservation.Resource, reservation: onegov.reservation.Reservation, request: onegov.org.request.OrgRequest) -> None Raises exceptions if the current user is anonymous and no longer should be given access to the reservation models. This could probably be done using morepath's security system, but it would not be quite as straight-forward. This approach is, though we have to manually add this function to all reservation views the anonymous user should be able to access when creating a new reservatin, but not anymore after that. .. py:function:: assert_access_only_if_there_are_reservations(reservations: collections.abc.Collection[Any]) -> None Raises an exception if no reservations are available. .. py:function:: respond_with_success(request: onegov.org.request.OrgRequest) -> onegov.core.types.JSON_ro .. py:function:: respond_with_error(request: onegov.org.request.OrgRequest, error: str) -> onegov.core.types.JSON_ro .. py:function:: reserve_allocation(self: onegov.reservation.Allocation, request: onegov.org.request.OrgRequest) -> onegov.core.types.JSON_ro Adds a single reservation to the list of reservations bound to the current browser session. Does not actually reserve anything, just keeps a list of things to reserve later. Though it will still check if the reservation is feasible. .. py:function:: delete_reservation(self: onegov.reservation.Reservation, request: onegov.org.request.OrgRequest) -> onegov.core.types.JSON_ro .. py:function:: get_reservation_form_class(resource: onegov.reservation.Resource, request: onegov.org.request.OrgRequest) -> type[onegov.org.forms.ReservationForm] .. py:function:: handle_reservation_form(self: onegov.reservation.Resource, request: onegov.org.request.OrgRequest, form: onegov.org.forms.ReservationForm, layout: onegov.org.layout.ReservationLayout | None = None) -> onegov.core.types.RenderData | webob.Response Asks the user for the form data required to complete one or many reservations on a resource. .. py:function:: get_next_resource_context(reservations: dict[onegov.reservation.Resource, list[onegov.reservation.Reservation]]) -> onegov.reservation.Resource .. py:function:: handle_find_your_spot_reservation_form(self: onegov.org.models.resource.FindYourSpotCollection, request: onegov.org.request.OrgRequest) -> webob.Response This is a convenience view that redirects to the appropriate resource specific reservation form. .. py:function:: blocked_by_zipcode(request: onegov.org.request.OrgRequest, resource: onegov.reservation.Resource, form: onegov.form.Form, reservations: collections.abc.Iterable[onegov.reservation.Reservation]) -> dict[int, blocked_by_zipcode.date] Returns a dict of reservation ids that are blocked by zipcode, with the value set to the date it will be available. .. py:function:: confirm_reservation(self: onegov.reservation.Resource, request: onegov.org.request.OrgRequest, layout: onegov.org.layout.ReservationLayout | None = None) -> onegov.core.types.RenderData .. py:function:: finalize_reservation(self: onegov.reservation.Resource, request: onegov.org.request.OrgRequest) -> webob.Response .. py:function:: accept_reservation(self: onegov.reservation.Reservation, request: onegov.org.request.OrgRequest, text: str | None = None, notify: bool = False, view_ticket: onegov.org.models.ticket.ReservationTicket | None = None) -> webob.Response .. py:function:: accept_reservation_from_ticket(self: onegov.org.models.ticket.ReservationTicket, request: onegov.org.request.OrgRequest) -> webob.Response .. py:function:: accept_reservation_with_message(self: onegov.reservation.Reservation, request: onegov.org.request.OrgRequest, form: onegov.org.forms.InternalTicketChatMessageForm, layout: onegov.org.layout.TicketChatMessageLayout | None = None, view_ticket: onegov.org.models.ticket.ReservationTicket | None = None) -> onegov.core.types.RenderData | webob.Response .. py:function:: accept_reservation_with_message_from_ticket(self: onegov.org.models.ticket.ReservationTicket, request: onegov.org.request.OrgRequest, form: onegov.org.forms.InternalTicketChatMessageForm, layout: onegov.org.layout.TicketChatMessageLayout | None = None) -> onegov.core.types.RenderData | webob.Response .. py:function:: reject_reservation(self: onegov.reservation.Reservation, request: onegov.org.request.OrgRequest, text: str | None = None, notify: bool = False, view_ticket: onegov.org.models.ticket.ReservationTicket | None = None) -> webob.Response | None .. py:function:: reject_reservation_from_ticket(self: onegov.org.models.ticket.ReservationTicket, request: onegov.org.request.OrgRequest) -> webob.Response | None .. py:function:: reject_reservation_with_message(self: onegov.reservation.Reservation, request: onegov.org.request.OrgRequest, form: onegov.org.forms.InternalTicketChatMessageForm, layout: onegov.org.layout.TicketChatMessageLayout | None = None, view_ticket: onegov.org.models.ticket.ReservationTicket | None = None) -> onegov.core.types.RenderData | webob.Response | None .. py:function:: reject_reservation_with_message_from_ticket(self: onegov.org.models.ticket.ReservationTicket, request: onegov.org.request.OrgRequest, form: onegov.org.forms.InternalTicketChatMessageForm, layout: onegov.org.layout.TicketChatMessageLayout | None = None) -> onegov.core.types.RenderData | webob.Response | None