reservation.core

Classes

LibresIntegration

Provides libres integration for

Module Contents

class reservation.core.LibresIntegration[source]

Provides libres integration for onegov.core.framework.Framework based applications.

The application must be connected to a database

Usage:

from onegov.core import Framework

class MyApp(Framework, LibresIntegration):
    pass
session_manager: onegov.core.orm.session_manager.SessionManager[source]
configure_libres(**cfg: Any) None[source]

Configures the libres integration and leaves two properties on the class:

Libres_context:

The libres context configured for the current application.

Libres_registrye:

The libres registry bound to the current application.

With those two a scheduler can easily be created:

from libres import new_scheduler
scheduler = new_scheduler(
    app.libres_context, 'test', 'Europe/Zurich'
)
configure_resource_pricing_schemes(*, resource_pricing_schemes: dict[str, list[str]] | None = None, **cfg: Any) None[source]
property resource_pricing_schemes: tuple[type[onegov.reservation.pricing_scheme.ResourcePricingScheme], ...][source]
static libres_context_from_session_manager(registry: libres.context.registry.Registry, session_manager: onegov.core.orm.session_manager.SessionManager, get_blocking_resource_ids: collections.abc.Callable[[uuid.UUID], collections.abc.Collection[uuid.UUID]]) libres.context.core.Context[source]
property libres_resources: onegov.reservation.collection.ResourceCollection[source]
get_blocking_resource_ids(resource: uuid.UUID) collections.abc.Collection[uuid.UUID][source]
_blocking_resource_id_mapping() dict[str, frozenset[uuid.UUID]][source]
get_ancestor_resource_ids(resource: uuid.UUID) tuple[uuid.UUID, ...][source]

This returns the ancestors ids in reverse hierarchical order.

I.e. first you get the parents, then the grandparents, etc.

Resources sharing the same generation will be returned in an arbitrary order.

_ancestor_resource_id_mapping() dict[str, tuple[uuid.UUID, ...]][source]