gazette.models.issue

Module Contents

Classes

IssueName

An issue, which consists of a year and a number.

IssuePdfFile

A general file (image, document, pdf, etc), referenced in the database.

Issue

Defines an issue.

class gazette.models.issue.IssueName[source]

Bases: NamedTuple

An issue, which consists of a year and a number.

The issue might be converted from to a string in the form of ‘year-number’ for usage in forms and databases.

year: int[source]
number: int[source]
__repr__() str[source]

Return repr(self).

classmethod from_string(value: str) typing_extensions.Self[source]
class gazette.models.issue.IssuePdfFile[source]

Bases: onegov.file.File

A general file (image, document, pdf, etc), referenced in the database.

Thanks to the use of Depot files can be seemingly stored in the database (with transaction guarantees), without actually storing it in the database.

__mapper_args__[source]
class gazette.models.issue.Issue[source]

Bases: onegov.core.orm.Base, onegov.core.orm.mixins.TimestampMixin, onegov.file.AssociatedFiles

Defines an issue.

property pdf: onegov.file.File | None[source]
property first_publication_number: int[source]

Returns the first publication number of this issue based on the last issue of the same year.

property in_use: bool[source]

True, if the issue is used by any notice.

__tablename__ = 'gazette_issues'[source]
id: Column[int][source]
name: Column[str][source]
number: Column[int | None][source]
date: Column[date_t][source]
deadline: Column[datetime | None][source]
notices(state: NoticeState | None = None) Query[GazetteNotice][source]

Returns a query to get all notices related to this issue.

publication_numbers(state: NoticeState | None = None) dict[int, str | None][source]

Returns a dictionary containing all publication numbers (by notice) of this issue.

date_observer(date_: datetime.date) None[source]

Changes the issue date of the notices when updating the date of the issue.

At this moment, the transaction is not yet commited: Querying the current issue returns the old date.

publish(request: onegov.gazette.request.GazetteRequest) None[source]

Publishes the issue.

This ensures that every accepted notice of this issue is published. It then creates the PDF while assigning the publications numbers (it uses the highest publication number of the last issue of the same year as a starting point.