flexmeasures.utils.app_utils

Utils for serving the FlexMeasures app

Functions

flexmeasures.utils.app_utils.find_first_applicable_config_entry(configs: list, setting_name: str, app: Flask | None = None) str | None
flexmeasures.utils.app_utils.init_sentry(app: Flask)

Configure Sentry. We need the app to read the Sentry DSN from configuration, and also to send some additional meta information.

flexmeasures.utils.app_utils.parse_config_entry_by_account_roles(config: str | tuple[str, list[str]], setting_name: str, app: Flask | None = None) str | None

Parse a config entry (which can be a string, e.g. “dashboard” or a tuple, e.g. (“dashboard”, [“MDC”])). In the latter case, return the first item (a string) only if the current user’s account roles match with the list of roles in the second item. Otherwise, return None.

flexmeasures.utils.app_utils.root_dispatcher()

Re-routes to root views fitting for the current user, depending on the FLEXMEASURES_ROOT_VIEW setting.