[settings] Better impl. of Setting class, tests for it and refactor hardcoded settings to use it.

This commit is contained in:
Romain Dorgueil
2017-07-05 12:41:14 +02:00
parent 6ef25deac9
commit 9801c75720
8 changed files with 115 additions and 21 deletions

View File

@ -27,9 +27,9 @@ def entrypoint(args=None):
args = parser.parse_args(args).__dict__
if args.pop('debug', False):
settings.DEBUG = True
settings.LOGGING_LEVEL = logging.DEBUG
logging.set_level(settings.LOGGING_LEVEL)
settings.DEBUG.set(True)
settings.LOGGING_LEVEL.set(logging.DEBUG)
logging.set_level(settings.LOGGING_LEVEL.get())
logger.debug('Command: ' + args['command'] + ' Arguments: ' + repr(args))
commands[args.pop('command')](**args)

View File

@ -31,10 +31,10 @@ def execute(filename, module, install=False, quiet=False, verbose=False):
from bonobo import Graph, run, settings
if quiet:
settings.QUIET = True
settings.QUIET.set(True)
if verbose:
settings.DEBUG = True
settings.DEBUG.set(True)
if filename:
if os.path.isdir(filename):