From 3577abe04ee542620052b4e808948ecfeb920cf8 Mon Sep 17 00:00:00 2001 From: Paul Pichaureau Date: Sat, 17 Mar 2018 17:00:33 +0100 Subject: [PATCH] Load all files in a data directory: "_all.yml" and other files if present. --- statik/database.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/statik/database.py b/statik/database.py index 68d8a23..feb1956 100644 --- a/statik/database.py +++ b/statik/database.py @@ -204,8 +204,7 @@ def load_model_data(self, path, model): # try find a model data collection if os.path.isfile(os.path.join(path, '_all.yml')): self.load_model_data_collection(path, model) - else: - self.load_model_data_from_files(path, model) + self.load_model_data_from_files(path, model) self.session.commit() def load_model_data_collection(self, path, model): @@ -284,6 +283,7 @@ def load_model_implicit_data(self, instance): def load_model_data_from_files(self, path, model): db_model = globals()[model.name] entry_files = list_files(path, ['yml', 'yaml', 'md']) + entry_files = [f for f in entry_files if not(f.endswith("_all.yml"))] seen_entries = set() logger.debug("Loading %d instance(s) for model: %s", len(entry_files), model.name) for entry_file in entry_files: