From 67a216ba189356ff70a9851cdc2aefc77125aa1c Mon Sep 17 00:00:00 2001 From: Sunil Mohan Adapa Date: Mon, 10 Feb 2020 17:42:12 -0800 Subject: [PATCH] app: Add info property as shortcut to access basic information Reviewed-by: James Valleroy --- plinth/app.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/plinth/app.py b/plinth/app.py index 87ffa235c..9de92bf45 100644 --- a/plinth/app.py +++ b/plinth/app.py @@ -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():