org.views.reservation

Functions

assert_anonymous_access_only_temporary(→ None)

Raises exceptions if the current user is anonymous and no longer

assert_access_only_if_there_are_reservations(→ None)

Raises an exception if no reservations are available.

respond_with_success(→ onegov.core.types.JSON_ro)

respond_with_error(→ onegov.core.types.JSON_ro)

reserve_allocation(→ onegov.core.types.JSON_ro)

Adds a single reservation to the list of reservations bound to the

delete_reservation(→ onegov.core.types.JSON_ro)

get_reservation_form_class(...)

handle_reservation_form(→ RenderData | Response)

Asks the user for the form data required to complete one or many

get_next_resource_context(→ onegov.reservation.Resource)

handle_find_your_spot_reservation_form(→ webob.Response)

This is a convenience view that redirects to the appropriate

blocked_by_zipcode(→ dict[int, blocked_by_zipcode.date])

Returns a dict of reservation ids that are blocked by zipcode, with

confirm_reservation(→ onegov.core.types.RenderData)

finalize_reservation(→ webob.Response)

accept_reservation(→ webob.Response)

accept_reservation_with_message(→ RenderData | Response)

reject_reservation(→ Response | None)

reject_reservation_with_message(...)

Module Contents

org.views.reservation.assert_anonymous_access_only_temporary(resource: onegov.reservation.Resource, reservation: onegov.reservation.Reservation, request: onegov.org.request.OrgRequest) None[source]

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.

org.views.reservation.assert_access_only_if_there_are_reservations(reservations: Collection[Any]) None[source]

Raises an exception if no reservations are available.

org.views.reservation.respond_with_success(request: onegov.org.request.OrgRequest) onegov.core.types.JSON_ro[source]
org.views.reservation.respond_with_error(request: onegov.org.request.OrgRequest, error: str) onegov.core.types.JSON_ro[source]
org.views.reservation.reserve_allocation(self: onegov.reservation.Allocation, request: onegov.org.request.OrgRequest) onegov.core.types.JSON_ro[source]

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.

org.views.reservation.delete_reservation(self: onegov.reservation.Reservation, request: onegov.org.request.OrgRequest) onegov.core.types.JSON_ro[source]
org.views.reservation.get_reservation_form_class(resource: onegov.reservation.Resource, request: onegov.org.request.OrgRequest) type[onegov.org.forms.ReservationForm][source]
org.views.reservation.handle_reservation_form(self: onegov.reservation.Resource, request: onegov.org.request.OrgRequest, form: onegov.org.forms.ReservationForm, layout: onegov.org.layout.ReservationLayout | None = None) RenderData | Response[source]

Asks the user for the form data required to complete one or many reservations on a resource.

org.views.reservation.get_next_resource_context(reservations: dict[onegov.reservation.Resource, list[onegov.reservation.Reservation]]) onegov.reservation.Resource[source]
org.views.reservation.handle_find_your_spot_reservation_form(self: onegov.org.models.resource.FindYourSpotCollection, request: onegov.org.request.OrgRequest) webob.Response[source]

This is a convenience view that redirects to the appropriate resource specific reservation form.

org.views.reservation.blocked_by_zipcode(request: onegov.org.request.OrgRequest, resource: onegov.reservation.Resource, form: onegov.form.Form, reservations: Iterable[Reservation]) dict[int, blocked_by_zipcode.date][source]

Returns a dict of reservation ids that are blocked by zipcode, with the value set to the date it will be available.

org.views.reservation.confirm_reservation(self: onegov.reservation.Resource, request: onegov.org.request.OrgRequest, layout: onegov.org.layout.ReservationLayout | None = None) onegov.core.types.RenderData[source]
org.views.reservation.finalize_reservation(self: onegov.reservation.Resource, request: onegov.org.request.OrgRequest) webob.Response[source]
org.views.reservation.accept_reservation(self: onegov.reservation.Reservation, request: onegov.org.request.OrgRequest, text: str | None = None, notify: bool = False) webob.Response[source]
org.views.reservation.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) RenderData | Response[source]
org.views.reservation.reject_reservation(self: onegov.reservation.Reservation, request: onegov.org.request.OrgRequest, text: str | None = None, notify: bool = False) Response | None[source]
org.views.reservation.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) RenderData | Response | None[source]