mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-01-21 07:55:00 +00:00
app: Add info property as shortcut to access basic information
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
parent
72ce23e377
commit
67a216ba18
@ -75,6 +75,20 @@ class App:
|
||||
if isinstance(component, component_type):
|
||||
yield component
|
||||
|
||||
@property
|
||||
def info(self):
|
||||
"""Return the information component of the app.
|
||||
|
||||
It is mandatory to have one :class:`~plinth.app.Info` component in
|
||||
every app to provide basic information about the app. Trying to access
|
||||
this property without having the Info component will result in a
|
||||
KeyError exception being raised. The lookup for the Info component is
|
||||
performed using the auto-generated component_id assigned to the Info
|
||||
component based on the app_id.
|
||||
|
||||
"""
|
||||
return self.get_component(self.app_id + '-info')
|
||||
|
||||
def enable(self):
|
||||
"""Enable all the components of the app."""
|
||||
for component in self.components.values():
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user