From c80a738c806697369d77b522b1f2524eec9e2c11 Mon Sep 17 00:00:00 2001 From: SoniEx2 Date: Sun, 26 Jul 2020 19:11:44 -0300 Subject: Add the run-once target I need to look into async/await before trying to make a proper run target, but this should help until then. --- ganarchy/core.py | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'ganarchy/core.py') diff --git a/ganarchy/core.py b/ganarchy/core.py index c225735..b1025d1 100644 --- a/ganarchy/core.py +++ b/ganarchy/core.py @@ -244,8 +244,20 @@ class GAnarchy: """ def __init__(self, dbconn, config): + self.title = None + self.base_url = None + self.projects = None + self._dbconn = dbconn + self._config = config + self.load_metadata() + + def load_metadata(self): + """Loads instance metadata from config. + + If instance metadata has already been loaded, re-loads it. + """ try: - base_url = config.get_property_value( + base_url = self._config.get_property_value( ganarchy.data.DataProperty.INSTANCE_BASE_URL ) except LookupError: @@ -253,7 +265,7 @@ class GAnarchy: raise ValueError try: - title = config.get_property_value( + title = self._config.get_property_value( ganarchy.data.DataProperty.INSTANCE_TITLE ) except LookupError: @@ -261,8 +273,6 @@ class GAnarchy: self.title = title self.base_url = base_url - self.projects = None - self._dbconn = dbconn def load_projects(self): """Loads the projects into this GAnarchy instance. -- cgit 1.4.1