election_day.app ================ .. py:module:: election_day.app Classes ------- .. autoapisummary:: election_day.app.ElectionDayApp Functions --------- .. autoapisummary:: election_day.app.get_static_directory election_day.app.get_template_directory election_day.app.get_theme election_day.app.get_i18n_localedirs election_day.app.get_i18n_used_locales election_day.app.get_i18n_default_locale election_day.app.org_content_security_policy election_day.app.enable_iframes_and_analytics_tween_factory election_day.app.override_language_tween_factory election_day.app.cache_control_tween_factory election_day.app.micro_cache_anonymous_pages_tween_factory election_day.app.get_shared_assets_path election_day.app.get_js_path election_day.app.get_css_path election_day.app.get_webasset_output election_day.app.get_common_asset election_day.app.get_custom_asset election_day.app.get_backend_common_asset election_day.app.get_screen_asset Module Contents --------------- .. py:class:: ElectionDayApp Bases: :py:obj:`onegov.core.Framework`, :py:obj:`onegov.form.FormApp`, :py:obj:`onegov.user.UserApp`, :py:obj:`onegov.file.DepotApp` The election day application. Include this in your onegov.yml to serve it with onegov-server. .. py:attribute:: serve_static_files :value: True 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: :mod:`onegov.core.static`. .. py:attribute:: request_class The class of the Request to create. Must be a subclass of :class:`morepath.Request`. By default the request class is :class:`morepath.Request` .. py:attribute:: csv_file .. py:attribute:: json_file .. py:attribute:: manage_form .. py:attribute:: manage_html .. py:attribute:: pdf_file .. py:attribute:: svg_file .. py:attribute:: screen_widget .. py:property:: principal :type: onegov.election_day.models.Canton | onegov.election_day.models.Municipality Returns the principal of the election day app. See :class:`onegov.election_day.models.principal.Principal`. .. py:method:: load_principal() -> onegov.election_day.models.Canton | onegov.election_day.models.Municipality | None The principal is defined in the ``principal.yml`` file stored on the applications filestorage root. If the file does not exist, the site root does not exist and therefore a 404 is returned. The structure of the yaml file is defined in class:`onegov.election_app.model.Principal`. .. py:property:: logo :type: onegov.core.filestorage.FilestorageFile | None Returns the logo as :class:`onegov.core.filestorage.FilestorageFile`. .. py:method:: load_logo() -> str | None .. py:property:: theme_options :type: dict[str, Any] Returns the application-bound theme options. .. py:property:: pages_cache :type: onegov.core.cache.RedisCacheRegion A cache for pages. .. py:function:: get_static_directory() -> str .. py:function:: get_template_directory() -> str .. py:function:: get_theme() -> onegov.election_day.theme.ElectionDayTheme .. py:function:: get_i18n_localedirs() -> list[str] .. py:function:: get_i18n_used_locales() -> set[str] .. py:function:: get_i18n_default_locale() -> str .. py:function:: org_content_security_policy() -> more.content_security.ContentSecurityPolicy .. py:function:: enable_iframes_and_analytics_tween_factory(app: ElectionDayApp, handler: collections.abc.Callable[[onegov.election_day.request.ElectionDayRequest], webob.Response]) -> collections.abc.Callable[[onegov.election_day.request.ElectionDayRequest], webob.Response] .. py:function:: override_language_tween_factory(app: ElectionDayApp, handler: collections.abc.Callable[[onegov.election_day.request.ElectionDayRequest], webob.Response]) -> collections.abc.Callable[[onegov.election_day.request.ElectionDayRequest], webob.Response] .. py:function:: cache_control_tween_factory(app: ElectionDayApp, handler: collections.abc.Callable[[onegov.election_day.request.ElectionDayRequest], webob.Response]) -> collections.abc.Callable[[onegov.election_day.request.ElectionDayRequest], webob.Response] .. py:function:: micro_cache_anonymous_pages_tween_factory(app: ElectionDayApp, handler: collections.abc.Callable[[onegov.election_day.request.ElectionDayRequest], webob.Response]) -> collections.abc.Callable[[onegov.election_day.request.ElectionDayRequest], webob.Response] .. py:function:: get_shared_assets_path() -> str .. py:function:: get_js_path() -> str .. py:function:: get_css_path() -> str .. py:function:: get_webasset_output() -> str .. py:function:: get_common_asset() -> collections.abc.Iterator[str] .. py:function:: get_custom_asset() -> collections.abc.Iterator[str] .. py:function:: get_backend_common_asset() -> collections.abc.Iterator[str] .. py:function:: get_screen_asset() -> collections.abc.Iterator[str]