Created
May 1, 2015 14:41
-
-
Save d0ugal/525de8d6a45cea8bff34 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DEFAULTS = { | |
'title': None, | |
'output': 'build', | |
'strict': False, | |
} | |
VALIDATORS = { | |
'title': must_be(str, required=True), | |
'output': path_validator(exists=True, directory=True, file=False) | |
'title': must_be(bool, required=True), | |
} | |
config = DEFAULTS.copy() | |
config.update(user_config) # loaded from a file | |
for option_name, value in config.items(): | |
try: | |
VALIDATORS[option_name](value) | |
except ValidationError as e: | |
print(e) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment