translator_directory.cli

Attributes

cli

LANGUAGES

Functions

fetch_users(→ None)

Implements the fetch-users cli command.

fetch_users_cli(→ Callable[[TranslatorAppRequest, ...)

Updates the list of users by fetching matching users

drive_distances_cli(→ Callable[[TranslatorAppRequest, ...)

geocode_cli(→ Callable[[TranslatorAppRequest, ...)

update_accounts_cli(→ Callable[[TranslatorAppRequest, ...)

Updates user accounts for translators.

migrate_nationalities(...)

Migrates the nationalities column into content column.

create_languages(→ Callable[[TranslatorAppRequest, ...)

Create languages for the selected translator schema. Languages get

force_delete_languages(...)

This command forcefully deletes all languages from the database and all

Module Contents

translator_directory.cli.cli[source]
translator_directory.cli.fetch_users(app: onegov.translator_directory.app.TranslatorDirectoryApp, session: sqlalchemy.orm.Session, ldap_server: str, ldap_username: str, ldap_password: str, admin_group: str, editor_group: str, verbose: bool = False, skip_deactivate: bool = False, dry_run: bool = False) None[source]

Implements the fetch-users cli command.

translator_directory.cli.fetch_users_cli(ldap_server: str, ldap_username: str, ldap_password: str, admin_group: str, editor_group: str, verbose: bool, skip_deactivate: bool, dry_run: bool) Callable[[TranslatorAppRequest, TranslatorDirectoryApp], None][source]

Updates the list of users by fetching matching users from a remote LDAP server.

This is currently highly specific for the Canton of Zug and therefore most values are hard-coded.

Example: .. code-block:: bash

onegov-translator –select /translator_directory/zug fetch-users

–ldap-server ‘ldaps://1.2.3.4’ –ldap-username ‘foo’ –ldap-password ‘bar’ –admin-group ‘ou=Admins’ –editor-group ‘ou=Editors’

translator_directory.cli.drive_distances_cli(dry_run: bool, only_empty: bool, tolerance_factor: float, max_tolerance: int, max_distance: int) Callable[[TranslatorAppRequest, TranslatorDirectoryApp], None][source]
translator_directory.cli.geocode_cli(dry_run: bool, only_empty: bool) Callable[[TranslatorAppRequest, TranslatorDirectoryApp], None][source]
translator_directory.cli.update_accounts_cli(dry_run: bool) Callable[[TranslatorAppRequest, TranslatorDirectoryApp], None][source]

Updates user accounts for translators.

translator_directory.cli.migrate_nationalities(dry_run: bool) Callable[[TranslatorAppRequest, TranslatorDirectoryApp], None][source]

Migrates the nationalities column into content column.

Example: .. code-block:: bash

onegov-translator –select /translator_directory/zug

migrate-nationalities –dry-run

translator_directory.cli.LANGUAGES = ('Afrikaans', 'Albanisch', 'Amharisch', 'Anyin', 'Arabisch', 'Arabisch (Dialekte)', 'Arabisch...[source]
translator_directory.cli.create_languages(dry_run: bool) Callable[[TranslatorAppRequest, TranslatorDirectoryApp], None][source]

Create languages for the selected translator schema. Languages get created if they don’t exist to prevent id changes.

This command is useful when new languages were added to the LANGUAGES list.

NOTE: No language will be deleted. If a language is not in the LANGUAGES list the script will print a message.

Example:

onegov-translator –select /translator_directory/schaffhausen create-languages –dry-run

translator_directory.cli.force_delete_languages(dry_run: bool) Callable[[TranslatorAppRequest, TranslatorDirectoryApp], None][source]

This command forcefully deletes all languages from the database and all references will be lost. This command is useful after the languages have changed and assigned a lot for testing.

Example:

onegov-translator –select /translator_directory/schaffhausen delete-languages –dry-run