From 41920e6f0d939eb73be76e8989b11801fac34d1e Mon Sep 17 00:00:00 2001 From: schneider <schneider@blinkenlichts.net> Date: Wed, 16 Aug 2023 23:02:09 +0200 Subject: [PATCH] apps: offer a way to get the bundle path --- python_payload/st3m/application.py | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/python_payload/st3m/application.py b/python_payload/st3m/application.py index a50a0b6870..532f2d8cc9 100644 --- a/python_payload/st3m/application.py +++ b/python_payload/st3m/application.py @@ -20,13 +20,20 @@ log = Log(__name__) class ApplicationContext: """ - Container for future application context. + Container for application context. - Envisioned are: path to the bundle, bundle data, + Further envisioned are: path to bundle data, path to a data directory, etc... """ - pass + _bundle_path: str + + def __init__(self, bundle_path: str = "") -> None: + self._bundle_path = bundle_path + + @property + def bundle_path(self) -> str: + return self._bundle_path class Application(BaseView): @@ -152,7 +159,7 @@ class BundleMetadata: log.info(f"Loaded {self.name} module: {m}") klass = getattr(m, class_entry) log.info(f"Loaded {self.name} class: {klass}") - inst = klass(ApplicationContext()) + inst = klass(ApplicationContext(self.path)) log.info(f"Instantiated {self.name} class: {inst}") return inst # type: ignore except Exception as e: -- GitLab