Skip to content
This repository has been archived by the owner on Jan 8, 2025. It is now read-only.

Load all files in a data directory: "_all.yml" and other files if present #89

Merged
merged 1 commit into from
Nov 19, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions statik/database.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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:
Expand Down