gazette.layout

Attributes

NestedMenu

Classes

Layout

Extends the base layout class with methods related to chameleon

MailLayout

A special layout for creating HTML E-Mails.

Module Contents

gazette.layout.NestedMenu: TypeAlias = list[tuple[str, str | None, bool, 'NestedMenu']][source]
class gazette.layout.Layout(model: Any, request: onegov.gazette.request.GazetteRequest)[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.

request: onegov.gazette.request.GazetteRequest[source]
date_with_weekday_format = 'EEEE dd.MM.yyyy'[source]
date_long_format = 'd. MMMM yyyy'[source]
datetime_with_weekday_format = 'EEEE dd.MM.yyyy HH:mm'[source]
breadcrumbs: list[str] = [][source]
session[source]
title() str[source]
property principal: onegov.gazette.models.Principal[source]
property user: User | None[source]
property font_awesome_path: str[source]
property sentry_init_path: str[source]
property copyright_year: int[source]
property sortable_url_template: str[source]
property publishing: bool[source]
property importation: bool[source]
property menu: NestedMenu[source]
property current_issue: onegov.gazette.models.Issue | None[source]
format_date(dt: datetime | date | None, format: str) str[source]

Returns a readable version of the given date while automatically converting to the principals timezone if the date is timezone aware.

format_issue(issue: onegov.gazette.models.Issue, date_format: str = 'date', notice: GazetteNotice | None = None) str[source]

Returns the issues number and date and optionally the publication number of the given notice.

format_text(text: str | None) str[source]
class gazette.layout.MailLayout(model: Any, request: onegov.gazette.request.GazetteRequest)[source]

Bases: Layout

A special layout for creating HTML E-Mails.

property base: chameleon.PageTemplateFile[source]

Returns the layout, which defines the base layout of all pages.

See templates/layout.pt.

property primary_color: str[source]