Пример #1
0
def CreateWebStatus(port,
                    templates=None,
                    tagComparator=None,
                    customEndpoints=None,
                    console_repo_filter=None,
                    console_builder_filter=None,
                    web_template_globals=None,
                    **kwargs):
    webstatus = WebStatus(port, **kwargs)
    webstatus.templates.filters.update({"escapejs": EscapeJs})
    if templates:
        # Manipulate the search path for jinja templates
        # pylint: disable=F0401
        import jinja2
        # pylint: disable=E1101
        old_loaders = webstatus.templates.loader.loaders
        # pylint: disable=E1101
        new_loaders = old_loaders[:1]
        new_loaders.extend([jinja2.FileSystemLoader(x) for x in templates])
        new_loaders.extend(old_loaders[1:])
        webstatus.templates.loader.loaders = new_loaders
    chromium_status.SetupChromiumPages(
        webstatus,
        tagComparator,
        customEndpoints,
        console_repo_filter=console_repo_filter,
        console_builder_filter=console_builder_filter)
    if web_template_globals:
        webstatus.templates.globals.update(web_template_globals)
    return webstatus
Пример #2
0
def CreateWebStatus(port, templates=None, tagComparator=None, **kwargs):
    webstatus = WebStatus(port, **kwargs)
    if templates:
        # Manipulate the search path for jinja templates
        # pylint: disable=F0401
        import jinja2
        # pylint: disable=E1101
        old_loaders = webstatus.templates.loader.loaders
        # pylint: disable=E1101
        new_loaders = old_loaders[:1]
        new_loaders.extend([jinja2.FileSystemLoader(x) for x in templates])
        new_loaders.extend(old_loaders[1:])
        webstatus.templates.loader.loaders = new_loaders
    chromium_status.SetupChromiumPages(webstatus, tagComparator)
    return webstatus