election_day.models.notification
Classes
Stores triggered notifications. |
|
Stores triggered notifications. |
|
Stores triggered notifications. |
|
Stores triggered notifications. |
Module Contents
- class election_day.models.notification.Notification[source]
Bases:
onegov.core.orm.Base
,onegov.core.orm.mixins.TimestampMixin
Stores triggered notifications.
- election_compound: relationship[ElectionCompound | None][source]
- class election_day.models.notification.WebhookNotification[source]
Bases:
Notification
Stores triggered notifications.
- trigger(request: onegov.election_day.request.ElectionDayRequest, model: onegov.election_day.models.election.Election | onegov.election_day.models.election_compound.ElectionCompound | onegov.election_day.models.vote.Vote) None [source]
Posts the summary of the given vote or election to the webhook URL defined for this principal.
This only works for external URLs. If posting to the server itself is needed, use a process instead of the thread:
process = Process(target=send_post_request, args=(urls, data)) process.start()
- class election_day.models.notification.EmailNotification[source]
Bases:
Notification
Stores triggered notifications.
- set_locale(request: onegov.election_day.request.ElectionDayRequest, locale: str | None = None) None [source]
Changes the locale of the request.
(Re)stores the intial locale if no locale is given.
- send_emails(request: onegov.election_day.request.ElectionDayRequest, elections: Sequence[Election], election_compounds: Sequence[ElectionCompound], votes: Sequence[Vote], subject: str | None = None) None [source]
Sends the results of the vote or election to all subscribers.
Adds unsubscribe headers (RFC 2369, RFC 8058).
- trigger(request: onegov.election_day.request.ElectionDayRequest, model: onegov.election_day.models.election.Election | onegov.election_day.models.election_compound.ElectionCompound | onegov.election_day.models.vote.Vote) None [source]
Sends the results of the vote, election or election compound to all subscribers.
Adds unsubscribe headers (RFC 2369, RFC 8058).
- class election_day.models.notification.SmsNotification[source]
Bases:
Notification
Stores triggered notifications.
- send_sms(request: onegov.election_day.request.ElectionDayRequest, elections: Sequence[Election], election_compounds: Sequence[ElectionCompound], votes: Sequence[Vote], content: translationstring.TranslationString, url: str | None = None) None [source]
Sends the given text to all subscribers.
- trigger(request: onegov.election_day.request.ElectionDayRequest, model: onegov.election_day.models.election.Election | onegov.election_day.models.election_compound.ElectionCompound | onegov.election_day.models.vote.Vote) None [source]
Posts a link to the vote or election to all subscribers.
This is done by writing files to a directory similary to maildir, sending the SMS is done using an external command, probably called by a cronjob.