betty.model.config module - Betty documentation

Hide navigation sidebar
Hide table of contents sidebar
Skip to content
Back to top
View this page
Toggle table of contents sidebar

# betty.model.config module

Configuration for the data model.

final class betty.model.config.EntityReference

  Bases: `Configuration`, `Generic`[`_EntityT`]

  Configuration that references an entity from the project’s ancestry.

  __init__(entity_type: type[_EntityT] | str | None = None, entity_id: str | None = None, *, entity_type_is_constrained: bool = False)
  dump() → DumpMapping[Dump] | str | None

    Produce a serialized data dump of `self`.

  property entity_id: str | None

    The referenced entity’s ID.

  property entity_type: str | None

    The referenced entity’s type.

  property entity_type_is_constrained: bool

    Whether the entity type may be changed.

  load(dump: Dump) → None

    Load a serialized data dump into `self`.

    Raises:

      betty.assertion.error.AssertionFailed – Raised if the dump is invalid.

  async validate(entity_type_repository: PluginRepository[Entity]) → None

    Validate the configuration.

final class betty.model.config.EntityReferenceSequence

  Bases: `Generic`[`_EntityT`], `ConfigurationSequence`[`EntityReference`[`_EntityT`]]

  Configuration for a sequence of references to entities from the project’s ancestry.

  __init__(entity_references: Iterable[EntityReference[_EntityT]] | None = None, *, entity_type_constraint: type[_EntityT] | str | None = None)
  async validate(entity_type_repository: PluginRepository[Entity]) → None

    Validate the configuration.