pas.cli

Attributes

Processor

log

cli

Functions

import_commission_data(→ Processor)

Note: This is deprecated, not really used, as we have the JSON import.

update_accounts_cli(→ Processor)

Updates user accounts for parliamentarians.

update_account_single_cli(→ Processor)

Updates user account for a single parliamentarian.

test_abschluss_mail(→ Processor)

Send a sample abschluss notification email for visual inspection.

import_kub_data(→ Processor)

Import data from the KUB API endpoints.

sync_user_accounts_cli(→ Processor)

Sync user accounts for all parliamentarians.

list_kantonsrat_cli(→ Processor)

List parliamentarians by Kantonsrat membership status.

update_custom_data(→ Processor)

Update parliamentarians with customFields data which

Module Contents

type pas.cli.Processor = Callable[[PasRequest, PasApp], None][source]
pas.cli.log[source]
pas.cli.cli[source]
pas.cli.import_commission_data(excel_file: str) Processor[source]

Note: This is deprecated, not really used, as we have the JSON import.

Import commission data from an Excel or csv file.

Assumes that the name of the commission is the filename.

Each row of this import contains a single line, which is a single parliamentarian and all the information about them.

Example:

onegov-pas –select ‘/onegov_pas/zug’ import-commission-data “Kommission_Gesundheit_und_Soziales.xlsx”

pas.cli.update_accounts_cli(dry_run: bool) Processor[source]

Updates user accounts for parliamentarians.

pas.cli.update_account_single_cli(username: str, dry_run: bool) Processor[source]

Updates user account for a single parliamentarian.

pas.cli.test_abschluss_mail(recipient: str) Processor[source]

Send a sample abschluss notification email for visual inspection.

Queues the mail. Flush via:

onegov-core sendmail –queue local_smtp

Inspect in smtp4dev UI.

Example:

onegov-pas –select ‘/onegov_pas/zug’ test-abschluss-mail –to dev@example.org

pas.cli.import_kub_data(token: str, base_url: str, cert_dir: str, update_custom: bool, max_workers: int) Processor[source]

Import data from the KUB API endpoints.

Fetches data from /people, /organizations, and /memberships endpoints and imports them using the existing import logic. Optionally updates parliamentarians with custom field data from individual API calls using multi-threaded processing for improved performance.

Example:

onegov-pas –select ‘/onegov_pas/zug’ import-kub-data –token “your-token-here”

# Skip custom data update: onegov-pas –select ‘/onegov_pas/zug’ import-kub-data –token “your-token-here” –no-update-custom

# Use more workers for faster custom data processing: onegov-pas –select ‘/onegov_pas/zug’ import-kub-data –token “your-token-here” –max-workers 5

pas.cli.sync_user_accounts_cli(dry_run: bool) Processor[source]

Sync user accounts for all parliamentarians.

Example:

onegov-pas –select ‘/onegov_pas/zug’ sync-user-accounts onegov-pas –select ‘/onegov_pas/zug’ sync-user-accounts –dry-run

pas.cli.list_kantonsrat_cli() Processor[source]

List parliamentarians by Kantonsrat membership status.

Shows who has an active Kantonsrat role (no party, no group, no additional_information, end is NULL or >= today).

Example:

onegov-pas –select ‘/onegov_pas/zug’ list-kantonsrat

pas.cli.update_custom_data(token: str, base_url: str, cert_dir: str, max_workers: int) Processor[source]

Update parliamentarians with customFields data which somehow is not included in the main /people api. Needs to be run after import_kub_data

Uses multi-threading to fetch custom data concurrently from the API while maintaining thread-safe database operations.

Example:

onegov-pas –select ‘/onegov_pas/zug’ update-custom-data –token “your-token-here” –base-url “url-ending-in/api/v2”

# Use more workers for faster processing: onegov-pas –select ‘/onegov_pas/zug’ update-custom-data –token “your-token-here” –base-url “url-ending-in/api/v2” –max-workers 5