Exemple #1
0
def validate_config(config):
    for setting in MONGODB_DEPRECATED_SETTINGS:
        if setting in config:
            msg = MONGODB_DEPRECATED_MSG.format(setting)
            log.warning(msg)
            warnings.warn(msg, category=DeprecationWarning, stacklevel=2)
    url = config['MONGODB_HOST']
    parsed_url = urlparse(url)
    if not all((parsed_url.scheme, parsed_url.netloc)):
        raise ConfigError('{0} is not a valid MongoDB URL'.format(url))
    if len(parsed_url.path) <= 1:
        raise ConfigError('{0} is missing the database path'.format(url))
Exemple #2
0
def check_config(cfg):
    default_language = cfg['DEFAULT_LANGUAGE']
    if default_language not in cfg.get('LANGUAGES', []):
        raise ConfigError('You are using a DEFAULT_LANGUAGE {0} not defined '
                          'into LANGUAGES'.format(default_language))