Browse Source

Simplify config_model

pull/200/head
Oliverpool 9 years ago
parent
commit
db8dff941a
  1. 15
      patacrep/build.py

15
patacrep/build.py

@ -372,13 +372,16 @@ class SongbookBuilder:
raise errors.CleaningError(self.basename + ext, exception)
def config_model(*args):
"""Get the model structure with schema and default options"""
def config_model(key):
"""Get the model structure
key can be:
- schema
- default
- description
"""
model_path = pkg_datapath('templates', 'songbook_model.yml')
with encoding.open_read(model_path) as model_file:
data = yaml.load(model_file)
while data and args:
name, *args = args
data = data.get(name)
return data
return data.get(key, {})

Loading…
Cancel
Save