def setup_version_control(app: web.Application): if not app[APP_SETTINGS_KEY].WEBSERVER_META_MODELING: raise SkipModuleSetup( reason= "{__name__} plugin was explictly disabled in the app settings") app.add_routes(version_control_handlers.routes)
def setup_foo(app: web.Application, arg1, kargs=33, *, raise_skip: bool = False): if raise_skip: raise SkipModuleSetup(reason="explicit skip") return True
def setup_version_control(app: web.Application): settings: ApplicationSettings = app[APP_SETTINGS_KEY] if not settings.WEBSERVER_DEV_FEATURES_ENABLED: raise SkipModuleSetup(reason="Development feature") app.add_routes(version_control_handlers.routes) app.add_routes(version_control_handlers_snapshots.routes)
def setup_meta_modeling(app: web.Application): if not app[APP_SETTINGS_KEY].WEBSERVER_META_MODELING: raise SkipModuleSetup( reason= "{__name__} plugin was explictly disabled in the app settings") app.add_routes(meta_modeling_handlers.routes) app.middlewares.append(projects_redirection_middleware) # Overrides run-policy from directorv2 assert get_project_run_policy(app) # nosec set_project_run_policy(app, meta_project_policy)
def setup_statics(app: web.Application) -> None: settings: StaticWebserverModuleSettings = assemble_settings(app) if not settings.STATIC_WEBSERVER_ENABLED: raise SkipModuleSetup( reason="static-webserver module was disabled in configuration") # serves information composed by making 3 http requests (once for each product) # to the index.html in each of the 3 product directories /osparc, /tis and /s4l app.router.add_get("/", get_cached_frontend_index, name=INDEX_RESOURCE_NAME) # statics.json is computed here and contains information used # by the frontend to properly render the client app.router.add_get("/static-frontend-data.json", get_statics_json) # compute statics.json content app.on_startup.append(_assemble_statics_json) # fetch all index.html for various frontends app.on_startup.append(_assemble_cached_indexes)