betty.model.config module

Configuration for the data model.

final class betty.model.config.EntityReference[source]

Bases: Configuration, Generic[_EntityCoT]

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

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

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[source]

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[source]

Validate the configuration.

final class betty.model.config.EntityReferenceSequence[source]

Bases: Generic[_EntityCoT], ConfigurationSequence[EntityReference[_EntityCoT]]

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

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

Validate the configuration.