ticket.collection
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
- ticket.collection.ExtendedTicketState: TypeAlias = TicketState | Literal['all', 'unfinished'][source]
- class ticket.collection.TicketCollectionPagination(session: sqlalchemy.orm.Session, page: int = 0, state: ExtendedTicketState = 'open', handler: str = 'ALL', group: str | None = None, owner: str = '*', extra_parameters: dict[str, Any] | None = None)[source]
Bases:
onegov.core.collection.Pagination
[onegov.ticket.model.Ticket
]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[Ticket] [source]
Returns an SQLAlchemy query containing all records that should be considered for pagination.
- class ticket.collection.TicketCollection(session: sqlalchemy.orm.Session, page: int = 0, state: ExtendedTicketState = 'open', handler: str = 'ALL', group: str | None = None, owner: str = '*', extra_parameters: dict[str, Any] | None = None)[source]
Bases:
TicketCollectionPagination
Provides collections with pagination, if they implement a few documented properties and methods.
See
onegov.ticket.TicketCollection
for an example.- issue_unique_ticket_number(handler_code: str) str [source]
Randomly generates a new ticket number, ensuring it is unique for the given handler_code.
The resulting code is of the following form:
XXX-0000-1111
Where
XXX
is the handler_code and the rest is a 12 character sequence of random numbers separated by dashes.This gives us 10^8 or 100 million ticket numbers for each handler.
Though we’ll never reach that limit, there is an increasing chance of conflict with existing ticket numbers, so we have to check against the database.
Still, this number is not unguessable (say in an URL) - there we have to rely on the internal ticket id, which is a uuid.
In a social engineering setting, where we don’t have the abilty to quickly try out thousands of numbers, the ticket number should be pretty unguessable however.
- open_ticket(handler_code: str, handler_id: str, **handler_data: Any) onegov.ticket.model.Ticket [source]
Opens a new ticket using the given handler.
- by_id(id: uuid.UUID, ensure_handler_code: str | None = None) onegov.ticket.model.Ticket | None [source]
- get_count(excl_archived: bool = True) TicketCount [source]
- class ticket.collection.ArchivedTicketCollection(session: sqlalchemy.orm.Session, page: int = 0, state: ExtendedTicketState = 'open', handler: str = 'ALL', group: str | None = None, owner: str = '*', extra_parameters: dict[str, Any] | None = None)[source]
Bases:
TicketCollectionPagination
Provides collections with pagination, if they implement a few documented properties and methods.
See
onegov.ticket.TicketCollection
for an example.