election_day.collections.subscribers
Attributes
Classes
Provides collections with pagination, if they implement a few |
|
Provides collections with pagination, if they implement a few |
|
Provides collections with pagination, if they implement a few |
Module Contents
- class election_day.collections.subscribers.SubscriberCollection(session: sqlalchemy.orm.Session, page: int = 0, term: str | None = None, active_only: bool | None = True)[source]
Bases:
onegov.core.collection.Pagination
[_S
]Provides collections with pagination, if they implement a few documented properties and methods.
See
onegov.ticket.TicketCollection
for an example.- __eq__(other: object) bool [source]
Returns True if the current and the other Pagination instance are equal. Used to find the current page in a list of pages.
- subset() Query[_S] [source]
Returns an SQLAlchemy query containing all records that should be considered for pagination.
- page_by_index(index: int) Self [source]
Returns the page at the given index. A page here means an instance of the class inheriting from the
Pagination
base class.
- add(address: str, domain: str | None, domain_segment: str | None, locale: str, active: bool) _S [source]
- by_address(address: str, domain: str | None, domain_segment: str | None) _S | None [source]
Returns the (first) subscriber by its address.
- initiate_subscription(address: str, domain: str | None, domain_segment: str | None, request: onegov.election_day.request.ElectionDayRequest) _S [source]
Initiate the subscription process.
Might be used to change the locale by re-subscribing.
- abstract handle_subscription(subscriber: _S, domain: str | None, domain_segment: str | None, request: onegov.election_day.request.ElectionDayRequest) None [source]
Send the subscriber a request to confirm the subscription.
- initiate_unsubscription(address: str, domain: str | None, domain_segment: str | None, request: onegov.election_day.request.ElectionDayRequest) None [source]
Initiate the unsubscription process.
- class election_day.collections.subscribers.EmailSubscriberCollection(session: sqlalchemy.orm.Session, page: int = 0, term: str | None = None, active_only: bool | None = True)[source]
Bases:
SubscriberCollection
[onegov.election_day.models.EmailSubscriber
]Provides collections with pagination, if they implement a few documented properties and methods.
See
onegov.ticket.TicketCollection
for an example.- handle_subscription(subscriber: onegov.election_day.models.EmailSubscriber, domain: str | None, domain_segment: str | None, request: onegov.election_day.request.ElectionDayRequest) None [source]
Send the (new) subscriber a request to confirm the subscription.
- confirm_subscription(address: str, domain: str | None, domain_segment: str | None, locale: str) bool [source]
Confirm the subscription.
- class election_day.collections.subscribers.SmsSubscriberCollection(session: sqlalchemy.orm.Session, page: int = 0, term: str | None = None, active_only: bool | None = True)[source]
Bases:
SubscriberCollection
[onegov.election_day.models.SmsSubscriber
]Provides collections with pagination, if they implement a few documented properties and methods.
See
onegov.ticket.TicketCollection
for an example.- handle_subscription(subscriber: onegov.election_day.models.SmsSubscriber, domain: str | None, domain_segment: str | None, request: onegov.election_day.request.ElectionDayRequest) None [source]
Confirm the subscription by sending an SMS (if not already subscribed). There is no double-opt-in for SMS subscribers.