Components#
Available components:
Base Classes#
- class plinth.app.Component(component_id)[source]#
Interface for an app component.
app_id is a string which is set to the value of the application’s app_id to which this component belongs. It is set when the component is added to an app. When the component is removed from an app, it set to None.
- property app#
Return the app this component is part of.
Raises KeyError if this component is not part of any app.
- diagnose() list[DiagnosticCheck][source]#
Run diagnostics and return results.
Return value must be a list of results. Each result is a
DiagnosticCheckwith a unique check_id, a user visible description of the test, the result, test parameters, and the component ID. The test result is a string enumeration from ‘failed’, ‘passed’, ‘error’, ‘warning’ and ‘not_done’.Also see
has_diagnostics().
- has_diagnostics()[source]#
Return whether at least one diagnostic test is implemented.
If this method return True, the
App.has_diagnostics(). also returns True.If a subclass of Component overrides the
diagnose()method, it is assumed that it is for implementing diagnostic tests and this method returns True for such a component. Override this method if this default behavior does not fit the needs.
- repair(failed_checks: list) bool[source]#
Try to fix failed diagnostics.
The default implementation only requests re-run setup for the app.
Returns whether the app setup should be re-run by the caller.
This method should be overridden by components that implement diagnose(), if there is a known way to fix failed checks. The return value can be changed to False to avoid causing a re-run setup.
failed_checks is a list of DiagnosticChecks related to this component that had failed or warning result.
- class plinth.app.LeaderComponent(component_id)[source]#
Interface for an app component that decides the state of the app.
These components determine if the app is enabled or not.
Other Classes#
- class plinth.diagnostic_check.DiagnosticCheck(check_id: str, description: str, result: Result = Result.NOT_DONE, parameters: dict[str, str | int | bool | None]=<factory>, component_id: str | None = None)[source]#
A diagnostic check and optional result and parameters.
- __init__(check_id: str, description: str, result: Result = Result.NOT_DONE, parameters: dict[str, str | int | bool | None]=<factory>, component_id: str | None = None) None#
- property translated_description#
Return translated string for description.