示例#1
0
文件: main.py 项目: Warrelis/merou
def create_api_application(graph, settings, usecase_factory):
    # type: (GroupGraph, ApiSettings, UseCaseFactory) -> GrouperApplication
    tornado_settings = {"debug": settings.debug}
    handler_settings = {"graph": graph, "usecase_factory": usecase_factory}
    handlers = [(route, handler_class, handler_settings)
                for (route, handler_class) in HANDLERS]
    return GrouperApplication(handlers, **tornado_settings)
示例#2
0
def create_fe_application(settings,
                          usecase_factory,
                          deployment_name,
                          xsrf_cookies=True,
                          session=None):
    # type: (Settings, UseCaseFactory, str, bool, Callable[[], Session]) -> GrouperApplication
    tornado_settings = {
        "debug": settings.debug,
        "static_path": os.path.join(os.path.dirname(grouper.fe.__file__),
                                    "static"),
        "xsrf_cookies": xsrf_cookies,
    }
    handler_settings = {
        "session": session if session else Session,
        "template_env": get_template_env(deployment_name=deployment_name),
        "usecase_factory": usecase_factory,
    }
    handlers = [(route, handler_class, handler_settings)
                for (route, handler_class) in HANDLERS]
    return GrouperApplication(handlers, **tornado_settings)
示例#3
0
def create_fe_application(
        settings,  # type: FrontendSettings
        deployment_name,  # type: str
        xsrf_cookies=True,  # type: bool
        session=None,  # type: Callable[[], Session]
):
    # type: (...) -> GrouperApplication
    static_path = os.path.join(os.path.dirname(grouper.fe.__file__), "static")
    tornado_settings = {
        "debug":
        settings.debug,
        "session":
        session if session else Session,
        "static_path":
        static_path,
        "template_engine":
        FrontendTemplateEngine(settings, deployment_name, static_path),
        "xsrf_cookies":
        xsrf_cookies,
    }
    return GrouperApplication(HANDLERS, **tornado_settings)