swissvotes.layouts.default

Classes

DefaultLayout

Extends the base layout class with methods related to chameleon

Module Contents

class swissvotes.layouts.default.DefaultLayout(model: Any, request: onegov.swissvotes.request.SwissvotesRequest)[source]

Bases: onegov.core.layout.ChameleonLayout

Extends the base layout class with methods related to chameleon template rendering.

This class assumes the existance of two templates:

  • layout.pt -> Contains the page skeleton with headers, body and so on.

  • macros.pt -> Contains chameleon macros.

app: onegov.swissvotes.app.SwissvotesApp[source]

Returns the application behind the request.

request: onegov.swissvotes.request.SwissvotesRequest[source]
day_long_format = 'skeleton:MMMMd'[source]
date_long_format = 'long'[source]
datetime_long_format = 'medium'[source]
pages[source]
property title: str[source]
property top_navigation: list[onegov.core.elements.Link][source]
property breadcrumbs: list[onegov.core.elements.Link][source]
property static_path: str[source]
property sentry_init_path: str[source]
property homepage_url: str[source]
property votes_url: str[source]
property login_url: str | None[source]
property logout_url: str | None[source]
property move_page_url_template: str[source]
property locales: list[tuple[str, str, str, str]][source]
format_policy_areas(vote: onegov.swissvotes.models.SwissVote) markupsafe.Markup[source]
format_bfs_number(number: decimal.Decimal) str[source]

Hide the decimal places if there are none (simple votes).

format_number(number: numbers.Number | decimal.Decimal | float | None, decimal_places: int | None = None, padding: str = '') str[source]

Takes the given numer and formats it according to locale.

If the number is an integer, the default decimal places are 0, otherwise 2.

Overwrites parent class to use “.” instead of “,” for fr_CH locale as would be returned by babel.