Exemplo n.º 1
0
def main():
    outlook_config = config.CreateConfig()
    spambayes_config = OptionsClass()
    spambayes_config.load_defaults(defaults)
    for fn, o, sects in [("outlook-options.html", outlook_config,
                          ("General", "Filter", "Training", "Notification")),
                         ("spambayes-options.html", spambayes_config,
                          ("Tokenizer", "General", "Classifier", "Storage"))]:
        f = open(fn, "w")
        f.write(table_header)
        for sect in sects:
            f.write('<tr style="height:1em">&nbsp;</tr>\n')
            opts = o.options_in_section(sect)
            opts.sort()
            for opt_name in opts:
                opt = o.get_option(sect, opt_name)
                if opt_name.startswith("x-"):
                    continue
                if opt.allowed_values in nice_regex_names:
                    replacement = nice_regex_names[opt.allowed_values]
                    if replacement is None:
                        continue
                    opt.allowed_values = (replacement,)
                f.write(opt.as_documentation_string(sect))
                f.write('\n')
        f.write("</table>\n")
        f.close()
    for fn, o in (("outlook-defaults.ini", outlook_config),
                  ("spambayes-defaults.ini", spambayes_config)):
        f = open(fn, "w")
        f.write(o.display(add_comments=True))
        f.close()
Exemplo n.º 2
0
def CreateConfig(defaults=defaults):

    options = OptionsClass()

    options.load_defaults(defaults)

    return options
Exemplo n.º 3
0
def main():
    options = OptionsClass()
    options.load_defaults(defaults)

    # Create HTML page that outline the available options.
    output = open("experimental_options.ht", "w")
    keys = options._options.keys()
    keys.sort()
    output.write(table_header)
    for sect, opt_name in keys:
        doc = options._options[sect, opt_name].doc()
        if not doc.startswith("(EXPERIMENTAL)"):
            continue
        output.write('<tr style="height:1em">&nbsp;</tr>\n')
        opt = options.get_option(sect, opt_name)

        # Replace regex's with readable descriptions.
        if opt.allowed_values in nice_regex_names:
            replacement = nice_regex_names[opt.allowed_values]
            if replacement is None:
                continue
            opt.allowed_values = (replacement, )

        output.write(opt.as_documentation_string(sect).\
                     replace("(EXPERIMENTAL) ", ""))
        output.write('\n')
    output.write("</table>\n\n")
    output.close()

    # Create pre-filled configuration file with comments.
    output = open("experimental.ini", "w")
    keys = options._options.keys()
    keys.sort()
    currentSection = None
    for sect, opt in keys:
        doc = options._options[sect, opt].doc()
        if doc.startswith("(EXPERIMENTAL)"):
            doc = doc[15:]
        else:
            continue
        if sect != currentSection:
            if currentSection is not None:
                output.write('\n')
            output.write('[')
            output.write(sect)
            output.write("]\n")
            currentSection = sect
        if not doc:
            doc = "No information available, sorry."
        doc = re.sub(r"\s+", " ", doc)
        output.write("\n# %s\n" % ("\n# ".join(textwrap.wrap(doc)), ))
        options._options[sect, opt].write_config(output)
    output.close()
def main():
    options = OptionsClass()
    options.load_defaults(defaults)

    # Create HTML page that outline the available options.
    output = open("experimental_options.ht", "w")
    keys = options._options.keys()
    keys.sort()
    output.write(table_header)
    for sect, opt_name in keys:
        doc = options._options[sect, opt_name].doc()
        if not doc.startswith("(EXPERIMENTAL)"):
            continue
        output.write('<tr style="height:1em">&nbsp;</tr>\n')
        opt = options.get_option(sect, opt_name)

        # Replace regex's with readable descriptions.
        if opt.allowed_values in nice_regex_names:
            replacement = nice_regex_names[opt.allowed_values]
            if replacement is None:
                continue
            opt.allowed_values = (replacement,)

        output.write(opt.as_documentation_string(sect).\
                     replace("(EXPERIMENTAL) ", ""))
        output.write('\n')
    output.write("</table>\n\n")
    output.close()

    # Create pre-filled configuration file with comments.
    output = open("experimental.ini", "w")
    keys = options._options.keys()
    keys.sort()
    currentSection = None
    for sect, opt in keys:
        doc = options._options[sect, opt].doc()
        if doc.startswith("(EXPERIMENTAL)"):
            doc = doc[15:]
        else:
            continue
        if sect != currentSection:
            if currentSection is not None:
                output.write('\n')
            output.write('[')
            output.write(sect)
            output.write("]\n")
            currentSection = sect
        if not doc:
            doc = "No information available, sorry."
        doc = re.sub(r"\s+", " ", doc)
        output.write("\n# %s\n" % ("\n# ".join(textwrap.wrap(doc)),))
        options._options[sect, opt].write_config(output)
    output.close()
Exemplo n.º 5
0
def main():
    outlook_config = config.CreateConfig()
    spambayes_config = OptionsClass()
    spambayes_config.load_defaults(defaults)

    # Create HTML pages that outline the available options.
    for fn, o, sects in [("outlook-options.html", outlook_config,
                          ("General", "Filter", "Training", "Notification")),
                         ("spambayes-options.html", spambayes_config,
                          ("Tokenizer", "General", "Classifier", "Storage"))]:
        f = open(fn, "w")
        f.write(table_header)

        for sect in sects:
            f.write('<tr style="height:1em">&nbsp;</tr>\n')
            opts = o.options_in_section(sect)
            opts.sort()
            for opt_name in opts:
                opt = o.get_option(sect, opt_name)

                # Skip experimental and deprecated.
                if opt_name.startswith("x-"):
                    continue

                # Replace regex's with readable descriptions.
                if opt.allowed_values in nice_regex_names:
                    replacement = nice_regex_names[opt.allowed_values]
                    if replacement is None:
                        continue
                    opt.allowed_values = (replacement, )

                f.write(opt.as_documentation_string(sect))
                f.write('\n')
        f.write("</table>\n")
        f.close()

    # Create pre-filled configuration files with comments.
    for fn, o in (("outlook-defaults.ini", outlook_config),
                  ("spambayes-defaults.ini", spambayes_config)):
        f = open(fn, "w")
        f.write(o.display(add_comments=True))
        f.close()
Exemplo n.º 6
0
def CreateConfig(defaults=defaults):
    options = OptionsClass()
    options.load_defaults(defaults)
    return options