From 88526c5e8956d996eb207def02dc606f618fd385 Mon Sep 17 00:00:00 2001 From: Giulia Naponiello Date: Mar 01 2018 18:48:58 +0000 Subject: Fixed pylint checks Fixed some pylint checks that were failing. --- diff --git a/greenwave/utils.py b/greenwave/utils.py index f8c2375..db6d792 100644 --- a/greenwave/utils.py +++ b/greenwave/utils.py @@ -53,23 +53,26 @@ def jsonp(func): def load_config(config_obj=None): """ - Load Greenwave configuration. If the config_obj is given, it will load the - configuration from there. Otherwise, it will load the configuration based on - how the environment is configured. - :param str config_obj: An config object. For example, greenwave.config.DevelopmentConfig. + Load Greenwave configuration. It will load the configuration based on how the environment is + configured. :return: A dict of Greenwave configuration. """ # Load default config, then override that with a config file config = Config(__name__) - default_config_file = os.getcwd() + '/conf/settings.py' - if os.getenv('DEV') == 'true': - default_config_obj = 'greenwave.config.DevelopmentConfig' - elif os.getenv('TEST') == 'true': - default_config_obj = 'greenwave.config.TestingConfig' + if config_obj is None: + if os.getenv('DEV') == 'true': + config_obj = 'greenwave.config.DevelopmentConfig' + elif os.getenv('TEST') == 'true': + config_obj = 'greenwave.config.TestingConfig' + else: + config_obj = 'greenwave.config.ProductionConfig' + + if os.getenv('DEV') == 'true' or os.getenv('TEST') == 'true': + default_config_file = os.getcwd() + '/conf/settings.py' else: - default_config_obj = 'greenwave.config.ProductionConfig' default_config_file = '/etc/greenwave/settings.py' - config.from_object(default_config_obj) + + config.from_object(config_obj) config_file = os.environ.get('GREENWAVE_CONFIG', default_config_file) config.from_pyfile(config_file) if os.environ.get('SECRET_KEY'):