Пример #1
0
def site_files_by_repo(site_name):
    """Yield tuples of repo_base, file_name."""
    params = load_as_params(site_name)
    dir_map = files.directories_for_each_repo(**params)
    for repo, dl in dir_map.items():
        for filename in files.search(dl):
            yield (repo, filename)
Пример #2
0
def documents_for_site(sitename):
    """Gathers all relevant documents for a site, which includes all type and
    global documents that are needed to render each site document.

    :param str sitename: Site name for which to gather documents.
    :returns: List of relevant documents.
    :rtype: list

    """

    documents = []

    params = load_as_params(sitename)
    paths = files.directories_for(**params)
    filenames = set(files.search(paths))
    for filename in filenames:
        documents.extend(files.read(filename))

    return documents
Пример #3
0
def documents_for_each_site():
    """Gathers all relevant documents per site, which includes all type and
    global documents that are needed to render each site document.

    :returns: Dictionary of documents, keyed by each site name.
    :rtype: dict

    """

    sitenames = list(files.list_sites())
    documents = {s: [] for s in sitenames}

    for sitename in sitenames:
        params = load_as_params(sitename)
        paths = files.directories_for(**params)
        filenames = set(files.search(paths))
        for filename in filenames:
            documents[sitename].extend(files.read(filename))

    return documents
Пример #4
0
def site_files(site_name):
    params = load_as_params(site_name)
    for filename in files.search(files.directories_for(**params)):
        yield filename