betty.document module¶
Manage documents.
A document is a singular file, such as an HTML page or a JSON file.
- final class betty.document.Breadcrumb¶
Bases:
LinkedDataDumpable[PortableMapping]A breadcrumb.
- final class betty.document.Breadcrumbs¶
Bases:
LinkedDataDumpable[PortableMapping],Iterable[Breadcrumb],SizedA trail of navigational breadcrumbs.
- __init__()¶
- final class betty.document.Document¶
Bases:
objectA document.
- __init__(resource: object = None, resource_url: object = None, /, *, breadcrumbs: Breadcrumbs | None = None, citer: Citer | None = None, entity_contexts: EntityContexts | None = None, context: Context | None = None, localizer: Localizer | None = None, media_type: ResolvableMediaType | None = None, title: Localizable | None = None, **document_vars: Any)¶
- property breadcrumbs: Breadcrumbs¶
The breadcrumbs.
- copy(*, media_type: ResolvableMediaType | None = None, resource: object = None, resource_url: object = None, **document_vars: Any) Self¶
Create a copy of this document, with the given fields added.
- property entity_contexts: EntityContexts¶
The entity contexts.
- property resource_url: object¶
The URL-generatable version of the resource itself.
This may be the resource itself or a completely different type of value.
- property title: Localizable | None¶
The human-readable title.
- class betty.document.DocumentProvider¶
Bases:
Plugin[DocumentProviderDefinition]Provide new documents.
- new_document_vars() DocumentVars¶
Create new variables for a new
betty.document.Document.Keys are the variable names, and values are variable values.
- final class betty.document.DocumentProviderDefinition¶
Bases:
PluginClsDefinition[DocumentProvider]The document provider plugin type.
Plugin type ID
document-providerDefinition
Built-in document providers:
- webpack (
Webpack)
- static type() PluginTypeDefinition[Self]¶
The plugin type definition.
- webpack (
- final class betty.document.DocumentProviderManufacturer¶
Bases:
PluginManufacturer[DocumentProviderDefinition,DocumentProvider]The document provider manufacturer.
- class betty.document.EntityContexts¶
Bases:
objectTrack the current entity contexts.
To allow templates to respond to their environment, this class allows our templates to set and get one entity per entity type for the current context.
Use cases include rendering an entity label as plain text if the template is in that entity’s context, but as a hyperlink if the template is not in the entity’s context.