app.services.errata_view¶
Errata part of the record detail page (read-only).
Converts the erratum rows that belong to a record (resolved by
app.services.record_relationships) into ErratumInfo
values, each with the approval state of the erratum’s own
identity and digest, and counts them in ErrataSummary for
the page’s top notice. The corrected record’s own digest, approval
state and history are never involved: an erratum is a separate record
with its own accept/reject workflow.
Approval state per erratum uses app.domain.approval.evaluate()
with the same approvable rule as the record detail
(app.services.approval_view.is_approvable()). The decision events
of all errata are read with one query
(list_decisions_for()), so the
detail endpoint’s query count does not grow with the number of errata.
Summary counts (published errata only; candidates are proposals and
are counted in proposed):
accepted->verified;not_required->verifiedas well: the policy requires no review, so a published erratum stands as published (the rawapproval_statestays on each item so the UI can label it precisely);rejected->rejected;changed_since_acceptance->changed(verified content was edited; not counted as verified);pendingandpolicy_missing->reported.
total is verified + reported + rejected + changed.
An erratum’s own page gets no rows (errata correct decisions, see
app.services.record_relationships), so its summary is all
zeros.
Public API: ErratumContentInfo, ErratumInfo,
ErrataSummary, ErrataView, erratum_content(),
build_errata().
- class app.services.errata_view.ErrataSummary(*, total, verified, reported, rejected, changed, proposed)¶
Bases:
objectErrata counts for the top notice; see the module docstring.
- Parameters:
total (
int) – Published errata.verified (
int) – Published errata accepted (or not requiring review).reported (
int) – Published errata awaiting review.rejected (
int) – Published errata rejected.changed (
int) – Published errata changed since acceptance.proposed (
int) – Candidate (proposed) errata.
- class app.services.errata_view.ErrataView(*, errata, summary)¶
Bases:
objectThe errata of one record with their summary.
- Parameters:
errata (
tuple[ErratumInfo,...]) – Published errata first, then candidates.summary (
ErrataSummary) – Counts.
- errata: tuple[ErratumInfo, ...]¶
- summary: ErrataSummary¶
- class app.services.errata_view.ErratumContentInfo(*, type, section, reported_by, reported_date, original_html, corrected_html, notes_html)¶
Bases:
objectThe structured content of one erratum.
- Parameters:
type (
ErratumType|None) –technicaloreditorial,Noneif invalid.section (
str|None) – Where in the decision the error is, if given.reported_by (
str|None) – Free-text reporter (informational only).reported_date (
date|None) – Authored report date, if valid.original_html (
str|None) – Sanitized “Original text” HTML, if any.corrected_html (
str) – Sanitized “Corrected text” HTML.
- type: ErratumType | None¶
- class app.services.errata_view.ErratumInfo(*, id, kind, ref, source_id, project, path, title, type, section, reported_by, reported_date, original_html, corrected_html, notes_html, approval_state, approvable, digest, updated_at, has_content)¶
Bases:
objectOne erratum (published or candidate) of the viewed record.
Content fields are
None(andcorrected_htmlempty) when the row was stored before erratum content was (has_contentfalse).- Parameters:
id (
UUID) – Erratum record id.kind (
RecordState) –publishedorcandidate(a proposal).ref (
str) – Branch/ref of the erratum content.source_id (
str) – Registration id of the erratum.project (
str) – Project path of the erratum.path (
str) – File path of the erratum.title (
str) – Erratum display title.type (
ErratumType|None) – Erratum type.corrected_html (
str) – “Corrected text” HTML.approval_state (
ApprovalStateCode) – Approval state of the erratum’s own digest.approvable (
bool) – Whether the erratum’s content can be decided.digest (
str) – The erratum’s current digest.updated_at (
datetime) – When the erratum’s content last changed.has_content (
bool) – Whether structured content is stored.
- kind: RecordState¶
- type: ErratumType | None¶
- approval_state: ApprovalStateCode¶
- app.services.errata_view.build_errata(store, rows, policy)¶
Evaluate the approval state of each erratum and count them.
- Parameters:
store (
CatalogStore) – Store of the caller’s unit of work.rows (
Sequence[ErratumRow]) – Erratum rows that belong to the viewed record.
- Return type:
- Returns:
The errata and their summary.
- app.services.errata_view.erratum_content(erratum)¶
Convert stored erratum content for the API.
- Parameters:
erratum (
StoredErratum|None) – Stored content, orNone.- Return type:
- Returns:
The content, or
None.