summary refs log tree commit diff stats
path: root/ganarchy/core.py
diff options
context:
space:
mode:
authorSoniEx2 <endermoneymod@gmail.com>2020-07-26 19:11:44 -0300
committerSoniEx2 <endermoneymod@gmail.com>2020-07-26 19:11:44 -0300
commitc80a738c806697369d77b522b1f2524eec9e2c11 (patch)
tree22db98bea4231d6958074a9e98501ff00cc74356 /ganarchy/core.py
parentbdf5cb78b9d7daf702e0e05660580ab311473fdc (diff)
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.
Diffstat (limited to 'ganarchy/core.py')
-rw-r--r--ganarchy/core.py18
1 files changed, 14 insertions, 4 deletions
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.