This is an automated email from the ASF dual-hosted git repository.
sbp pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tooling-trusted-releases.git
The following commit(s) were added to refs/heads/main by this push:
new 98d745c Make the use of configuration more efficient in the server
module
98d745c is described below
commit 98d745cbaede17bda2c92bb0f309bf132fc437f3
Author: Sean B. Palmer <[email protected]>
AuthorDate: Wed Jan 21 18:33:44 2026 +0000
Make the use of configuration more efficient in the server module
---
atr/principal.py | 2 +-
atr/server.py | 19 +++++++++----------
atr/tabulate.py | 3 ++-
3 files changed, 12 insertions(+), 12 deletions(-)
diff --git a/atr/principal.py b/atr/principal.py
index f6aab09..7ebb530 100644
--- a/atr/principal.py
+++ b/atr/principal.py
@@ -148,7 +148,7 @@ class Committer:
ldap_scope="BASE",
)
if not (result and (len(result) == 1)):
- raise CommitterError(f"Authentication failed")
+ raise CommitterError("Authentication failed")
except CommitterError:
raise
except Exception as ex:
diff --git a/atr/server.py b/atr/server.py
index 263f6e1..6a61f8f 100644
--- a/atr/server.py
+++ b/atr/server.py
@@ -229,7 +229,7 @@ def _app_setup_context(app: base.QuartApp) -> None:
}
-def _app_setup_lifecycle(app: base.QuartApp) -> None:
+def _app_setup_lifecycle(app: base.QuartApp, app_config:
type[config.AppConfig]) -> None:
"""Setup application lifecycle hooks."""
@app.before_serving
@@ -247,19 +247,18 @@ def _app_setup_lifecycle(app: base.QuartApp) -> None:
scheduler_task = asyncio.create_task(_register_recurrent_tasks())
app.extensions["scheduler_task"] = scheduler_task
- await _initialise_test_environment()
+ await _initialise_test_environment(app_config)
- conf = config.get()
- pubsub_url = conf.PUBSUB_URL
- pubsub_user = conf.PUBSUB_USER
- pubsub_password = conf.PUBSUB_PASSWORD
+ pubsub_url = app_config.PUBSUB_URL
+ pubsub_user = app_config.PUBSUB_USER
+ pubsub_password = app_config.PUBSUB_PASSWORD
parsed_pubsub_url = urllib.parse.urlparse(pubsub_url) if pubsub_url
else None
valid_pubsub_url = bool(parsed_pubsub_url and parsed_pubsub_url.scheme
and parsed_pubsub_url.netloc)
if valid_pubsub_url and pubsub_url and pubsub_user and pubsub_password:
log.info("Starting PubSub SVN listener")
listener = pubsub.SVNListener(
- working_copy_root=conf.SVN_STORAGE_DIR,
+ working_copy_root=app_config.SVN_STORAGE_DIR,
url=pubsub_url,
username=pubsub_user,
password=pubsub_password,
@@ -451,7 +450,7 @@ def _create_app(app_config: type[config.AppConfig]) ->
base.QuartApp:
filters.register_filters(app)
_app_setup_context(app)
_app_setup_security_headers(app)
- _app_setup_lifecycle(app)
+ _app_setup_lifecycle(app, app_config)
# _register_recurrent_tasks()
@@ -480,8 +479,8 @@ def _create_app(app_config: type[config.AppConfig]) ->
base.QuartApp:
return app
-async def _initialise_test_environment() -> None:
- if not config.get().ALLOW_TESTS:
+async def _initialise_test_environment(conf: type[config.AppConfig]) -> None:
+ if not conf.ALLOW_TESTS:
return
async with db.session() as data:
diff --git a/atr/tabulate.py b/atr/tabulate.py
index 1f2d7a8..2030437 100644
--- a/atr/tabulate.py
+++ b/atr/tabulate.py
@@ -26,6 +26,7 @@ import atr.util as util
MAX_THREAD_MESSAGES = 10000
+
async def vote_committee(thread_id: str, release: sql.Release) ->
sql.Committee | None:
committee = release.project.committee
if util.is_dev_environment():
@@ -140,7 +141,7 @@ def vote_summary(tabulated_votes: dict[str,
models.tabulate.VoteEmail]) -> dict[
return result
-async def votes(
+async def votes( # noqa: C901
committee: sql.Committee | None, thread_id: str
) -> tuple[int | None, dict[str, models.tabulate.VoteEmail]]:
"""Tabulate votes."""
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]