translator_directory.collections.translator
Attributes
Classes
Abstract base class for generic types. |
Module Contents
- class translator_directory.collections.translator.TranslatorCollection(app: onegov.translator_directory.app.TranslatorDirectoryApp, page: int = 0, written_langs: list[str] | None = None, spoken_langs: list[str] | None = None, monitor_langs: list[str] | None = None, order_by: str | None = None, order_desc: bool = False, user_role: str | None = None, search: str | None = None, guilds: list[str] | None = None, interpret_types: list[str] | None = None, state: str | None = 'published', admissions: list[str] | None = None, genders: list[str] | None = None)[source]
Bases:
onegov.core.collection.GenericCollection
[onegov.translator_directory.models.translator.Translator
],onegov.core.collection.Pagination
[onegov.translator_directory.models.translator.Translator
]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.
- add(update_user: bool = True, **kwargs: Any) onegov.translator_directory.models.translator.Translator [source]
- update_user(item: onegov.translator_directory.models.translator.Translator, new_email: str | None) None [source]
Keep the translator and its user account in sync.
Creates a new user account if an email address is set (if not already existing).
Disable user accounts if an email has been deleted.
Change usernames if an email has changed.
Make sure used user accounts have the right role.
Make sure used user accounts are activated.
Make sure the password is changed if activated or disabled.
- subset() Query[Translator] [source]
Returns an SQLAlchemy query containing all records that should be considered for pagination.
- property by_search_term_expression: tuple[ColumnElement[bool], Ellipsis][source]
Search for any word in any field of the search columns
- by_lastname(lastname: str) onegov.translator_directory.models.translator.Translator | None [source]
- 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.
- query() Query[Translator] [source]