election_day.utils.pdf_generator

Classes

PdfGenerator

Module Contents

class election_day.utils.pdf_generator.PdfGenerator(app: onegov.election_day.app.ElectionDayApp, request: onegov.election_day.request.ElectionDayRequest, renderer: onegov.election_day.utils.d3_renderer.D3Renderer | None = None)[source]
app[source]
request[source]
pdf_dir = 'pdf'[source]
session[source]
renderer[source]
remove(directory: str, files: Collection[str]) None[source]

Safely removes the given files from the directory.

generate_pdf(item: onegov.election_day.models.Election | onegov.election_day.models.ElectionCompound | onegov.election_day.models.Vote, path: str, locale: str) None[source]

Generates the PDF for an election or a vote.

add_tacit_election(principal: Canton | Municipality, election: onegov.election_day.models.Election, pdf: onegov.election_day.pdf.Pdf) None[source]
add_election(principal: Canton | Municipality, election: onegov.election_day.models.Election, pdf: onegov.election_day.pdf.Pdf) None[source]
add_election_compound(principal: Canton | Municipality, compound: onegov.election_day.models.ElectionCompound, pdf: onegov.election_day.pdf.Pdf) None[source]
add_vote(principal: Canton | Municipality, vote: onegov.election_day.models.Vote, pdf: onegov.election_day.pdf.Pdf, locale: str) None[source]
create_pdfs() tuple[int, int][source]

Generates all PDFs for the given application.

Only generates PDFs if not already generated since the last change of the election, election compound or vote.

Cleans up unused files.