Beispiel #1
0

format_templates_lookup = LazyDict(create_format_templates_lookup)


def create_output_formats_lookup():
    """Create output formats."""
    out = {}

    for f in output_formats_files:
        of = os.path.basename(f).lower()
        data = {'names': {}}
        if of.endswith('.yml'):
            of = of[:-4]
            with open(f, 'r') as f:
                data.update(yaml.load(f) or {})
                data['code'] = of
        else:
            continue  # unknown filetype
        if of in out:
            continue
        out[of] = data
    return out

output_formats = LazyDict(create_output_formats_lookup)

export_formats = LazyDict(lambda: dict(
    (code, of) for code, of in output_formats.items()
    if of.get('content_type', '') != 'text/html' and of.get('visibility', 0)
))
Beispiel #2
0

format_templates_lookup = LazyDict(create_format_templates_lookup)


def create_output_formats_lookup():
    """Create output formats."""
    out = {}

    for f in output_formats_files:
        of = os.path.basename(f).lower()
        data = {'names': {}}
        if of.endswith('.yml'):
            of = of[:-4]
            with open(f, 'r') as f:
                data.update(yaml.load(f) or {})
                data['code'] = of
        else:
            continue  # unknown filetype
        if of in out:
            continue
        out[of] = data
    return out


output_formats = LazyDict(create_output_formats_lookup)

export_formats = LazyDict(lambda: dict(
    (code, of) for code, of in output_formats.items()
    if of.get('content_type', '') != 'text/html' and of.get('visibility', 0)))