示例#1
0
function_str_perl = ''''%s' => N("%s"),
'''

function_str_python = '''
    '%s': _("%s"), '''

function_str_wiki = ''';%s: %s
'''

help_perl = open(help_perl_file, "w")
help_python = open(help_python_file, "w")
help_wiki = open(help_wiki_file, "w")

# process all configuration parameters
log = Log(log_syslog=False, log_file=False)
msec = MSEC(log, plugins='plugins')

print >>help_perl, header_perl
print >>help_python, header_python
print >>help_wiki, header_wiki

for variable in config.SETTINGS:
    callback, params = config.SETTINGS[variable]
    func = msec.get_action(callback)
    if func:
        print >>help_perl, function_str_perl % (variable, func.__doc__.strip())
        print >>help_python, function_str_python % (variable, func.__doc__.strip())
        print >>help_wiki, function_str_wiki % (variable, func.__doc__.strip())

print >>help_perl, footer_perl
print >>help_python, footer_python
示例#2
0
文件: msec.py 项目: eugeni/msec
    config.merge_with_baselevel(log, msec_config, msec_config.get_base_level(), config.load_defaults, root='')
    config.merge_with_baselevel(log, permconf, msec_config.get_base_level(), config.load_default_perms, root='')

    # saving current setting as new level
    if save:
        newlevel = config.MsecConfig(log, config=config.SECURITY_LEVEL % (root, level))
        newlevel.merge(msec_config, overwrite=True)
        # update new level name
        newlevel.set("BASE_LEVEL", level)
        newlevel.save()
        # saving new file permissions, if any
        newpermlevel = config.PermConfig(log, config=config.PERMISSIONS_LEVEL % (root, level))
        newpermlevel.merge(permconf, overwrite=True)
        newpermlevel.save()
        sys.exit(0)

    # load the msec library
    msec = MSEC(log, root=root)

    # apply the config to msec
    msec.apply(msec_config)
    # writing back changes
    msec.commit(commit)
    # saving updated config
    if commit:
        if not msec_config.save(levelconf):
            log.error(_("Unable to save config!"))
        if not permconf.save(standard_permconf):
            log.error(_("Unable to save file system permissions!"))
    sys.exit(0)