From 5ab921195884e5e230b204f4af4ef525df4a2f85 Mon Sep 17 00:00:00 2001 From: Jake Howard Date: Wed, 29 Mar 2017 18:50:12 +0100 Subject: [PATCH] allow reading config by dot --- md_pdf/config/read.py | 3 ++- md_pdf/config/validate.py | 2 +- setup.py | 1 + 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/md_pdf/config/read.py b/md_pdf/config/read.py index 5a6f0d4..2ae0bcd 100644 --- a/md_pdf/config/read.py +++ b/md_pdf/config/read.py @@ -1,8 +1,9 @@ import yaml +from dotmap import DotMap import os from md_pdf.consts import CONFIG_FILE def load_config(): with open(os.path.join(CONFIG_FILE)) as f: - return yaml.load(f) + return DotMap(yaml.load(f)) diff --git a/md_pdf/config/validate.py b/md_pdf/config/validate.py index f01e83c..a0d4c0f 100644 --- a/md_pdf/config/validate.py +++ b/md_pdf/config/validate.py @@ -10,7 +10,7 @@ REQUIRED_KEYS = [ def check_required_keys(config): missing_keys = [key for key in REQUIRED_KEYS if key not in config] if missing_keys: - raise ConfigValidationException("Missing required keys: {}".format(missing_keys)) + raise ConfigValidationException("Missing required keys: {}".format(", ".join(missing_keys))) def validate_config(config): diff --git a/setup.py b/setup.py index 75cf615..f587171 100644 --- a/setup.py +++ b/setup.py @@ -6,6 +6,7 @@ setup( version="1.0", install_requires=[ "beautifulsoup4==4.5.3", + "dotmap==1.2.17", "jinja2==2.9.5", "pdfkit==0.6.1", "pypandoc==1.3.3",