swissvotes.app

Classes

SwissvotesApp

The swissvotes application. Include this in your onegov.yml to serve

Functions

get_static_directory(→ str)

get_template_directory(→ str)

get_theme(→ onegov.swissvotes.theme.SwissvotesTheme)

get_i18n_localedirs(→ list[str])

get_i18n_used_locales(→ set[str])

get_i18n_default_locale(→ str)

org_content_security_policy(...)

get_shared_assets_path(→ str)

get_js_path(→ str)

get_css_path(→ str)

get_webasset_output(→ str)

get_frameworks_asset(→ Iterator[str])

get_common_asset(→ Iterator[str])

get_mastodon_asset(→ Iterator[str])

get_stats_asset(→ Iterator[str])

Module Contents

class swissvotes.app.SwissvotesApp[source]

Bases: onegov.core.Framework, onegov.form.FormApp, onegov.quill.QuillApp, onegov.file.DepotApp, onegov.user.UserApp

The swissvotes application. Include this in your onegov.yml to serve it with onegov-server.

serve_static_files = True[source]

Returns True if /static files should be served. Needs to be enabled manually.

Note that even if the static files are not served, /static path is still served, it just won’t return anything but a 404.

Note also that static files are served publicly. You can override this in your application, but doing that and testing for it is on you!

See also: onegov.core.static.

property principal: onegov.swissvotes.models.Principal[source]
property static_content_pages: set[str][source]
get_cached_dataset(format: Literal['csv']) str[source]
get_cached_dataset(format: Literal['xlsx']) bytes

Gets or creates the dataset in the requested format.

We store the dataset using the last modified timestamp - this way, we have a version of past datasets. Note that we don’t delete any old datasets.

configure_mfg_api_token(*, mfg_api_token: str | None = None, **cfg: Any) None[source]

Configures the Museum für Gestaltung API Token.

swissvotes.app.get_static_directory() str[source]
swissvotes.app.get_template_directory() str[source]
swissvotes.app.get_theme() onegov.swissvotes.theme.SwissvotesTheme[source]
swissvotes.app.get_i18n_localedirs() list[str][source]
swissvotes.app.get_i18n_used_locales() set[str][source]
swissvotes.app.get_i18n_default_locale() str[source]
swissvotes.app.org_content_security_policy() more.content_security.ContentSecurityPolicy[source]
swissvotes.app.get_shared_assets_path() str[source]
swissvotes.app.get_js_path() str[source]
swissvotes.app.get_css_path() str[source]
swissvotes.app.get_webasset_output() str[source]
swissvotes.app.get_frameworks_asset() Iterator[str][source]
swissvotes.app.get_common_asset() Iterator[str][source]
swissvotes.app.get_mastodon_asset() Iterator[str][source]
swissvotes.app.get_stats_asset() Iterator[str][source]