winterthur.collections.mission_report
Attributes
Classes
Manages files. |
|
Abstract base class for generic types. |
|
Abstract base class for generic types. |
Module Contents
- class winterthur.collections.mission_report.MissionReportFileCollection(session: sqlalchemy.orm.Session, report: onegov.winterthur.models.MissionReport)[source]
Bases:
onegov.org.models.file.BaseImageFileCollection
[onegov.winterthur.models.MissionReportFile
]Manages files.
- Parameters:
session – The SQLAlchemy db session to use.
type – The polymorphic type to use and to filter for, or ‘*’ for all.
allow_duplicates –
Prevents duplicates if set to false. Duplicates are detected before pre-processing, so already stored files may be downloaded and added again, as they might have changed during the upload.
Note that this does not change existing files. It only prevents new duplicates from being added.
- add(*args, **kwargs)[source]
Adds a file with the given filename. The content maybe either in bytes or a file object.
- query() Query[MissionReportFile] [source]
- class winterthur.collections.mission_report.MissionReportCollection(session: sqlalchemy.orm.Session, page: int = 0, include_hidden: bool = False, year: int | None = None)[source]
Bases:
onegov.core.collection.GenericCollection
[onegov.winterthur.models.MissionReport
],onegov.core.collection.Pagination
[onegov.winterthur.models.MissionReport
]Abstract base class for generic types.
A generic type is typically declared by inheriting from this class parameterized with one or more type variables. For example, a generic mapping type might be defined as:
class Mapping(Generic[KT, VT]): def __getitem__(self, key: KT) -> VT: ... # Etc.
This class can then be used as follows:
def lookup_name(mapping: Mapping[KT, VT], key: KT, default: VT) -> VT: try: return mapping[key] except KeyError: return default
- __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.
- query() Query[MissionReport] [source]
- query_all() Query[MissionReport] [source]
- query_current_year() Query[MissionReport] [source]
- subset() Query[MissionReport] [source]
Returns an SQLAlchemy query containing all records that should be considered for pagination.
- class winterthur.collections.mission_report.MissionReportVehicleCollection(session: sqlalchemy.orm.Session, **kwargs: Any)[source]
Bases:
onegov.core.collection.GenericCollection
[onegov.winterthur.models.MissionReportVehicle
]Abstract base class for generic types.
A generic type is typically declared by inheriting from this class parameterized with one or more type variables. For example, a generic mapping type might be defined as:
class Mapping(Generic[KT, VT]): def __getitem__(self, key: KT) -> VT: ... # Etc.
This class can then be used as follows:
def lookup_name(mapping: Mapping[KT, VT], key: KT, default: VT) -> VT: try: return mapping[key] except KeyError: return default
- query() Query[MissionReportVehicle] [source]