Skip to content

Instantly share code, notes, and snippets.

@d0ugal
Created May 1, 2015 14:41
Show Gist options
  • Save d0ugal/525de8d6a45cea8bff34 to your computer and use it in GitHub Desktop.
Save d0ugal/525de8d6a45cea8bff34 to your computer and use it in GitHub Desktop.
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