コード例 #1
0
def get_setting(variable):

    try:
        value = read_json(settings_file)[variable]
    except Exception:
        if variable not in DEFAULTS:
            logger.info("Defaults not found for variable: {}".format(variable))
        value = DEFAULTS[variable]
    return value
コード例 #2
0
ファイル: config_file.py プロジェクト: fantomid/kano-settings
def get_setting(variable):

    try:
        value = read_json(settings_file)[variable]
    except Exception:
        if variable not in DEFAULTS:
            logger.info("Defaults not found for variable: {}".format(variable))
        value = DEFAULTS[variable]
    return value
コード例 #3
0
ファイル: advanced.py プロジェクト: isabella232/kano-settings
def set_chromium_policies(policies):
    if not os.path.exists(chromium_policy_file):
        ensure_dir(os.path.dirname(chromium_policy_file))
        policy_config = {}
    else:
        policy_config = read_json(chromium_policy_file)

    for policy in policies:
        policy_config[policy[0]] = policy[1]

    write_json(chromium_policy_file, policy_config)
コード例 #4
0
def set_setting(variable, value):

    if username == 'root':
        return

    logger.debug(u"config_file / set_setting: {} {}".format(variable, value))

    data = read_json(settings_file)
    if not data:
        data = dict()

    data[variable] = value
    write_json(settings_file, data)
    chown_path(settings_file)
コード例 #5
0
ファイル: config_file.py プロジェクト: fantomid/kano-settings
def set_setting(variable, value):

    if username == 'root':
        return

    logger.debug(u"config_file / set_setting: {} {}".format(variable, value))

    data = read_json(settings_file)
    if not data:
        data = dict()

    data[variable] = value
    write_json(settings_file, data)
    chown_path(settings_file)