You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tooling.apache.org by sb...@apache.org on 2025/06/18 19:39:57 UTC
(tooling-trusted-release) branch main updated: Fix interface order across multiple modules
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-release.git
The following commit(s) were added to refs/heads/main by this push:
new 4c7c7fc Fix interface order across multiple modules
4c7c7fc is described below
commit 4c7c7fcdecc0426d792eb1751384af7248fdcb09
Author: Sean B. Palmer <se...@miscoranda.com>
AuthorDate: Wed Jun 18 20:39:38 2025 +0100
Fix interface order across multiple modules
---
atr/blueprints/admin/admin.py | 4 ++--
atr/blueprints/admin/templates/ldap-lookup.html | 2 +-
atr/routes/published.py | 24 +++++++++----------
atr/template.py | 31 ++++++++++++-------------
atr/templates/includes/sidebar.html | 4 ++--
5 files changed, 32 insertions(+), 33 deletions(-)
diff --git a/atr/blueprints/admin/admin.py b/atr/blueprints/admin/admin.py
index 9e89085..f4d0163 100644
--- a/atr/blueprints/admin/admin.py
+++ b/atr/blueprints/admin/admin.py
@@ -436,7 +436,7 @@ async def admin_keys_update() -> str | response.Response | tuple[Mapping[str, An
@admin.BLUEPRINT.route("/ldap/", methods=["GET"])
-async def ldap_search() -> str:
+async def admin_ldap() -> str:
form = await LdapLookupForm.create_form(data=quart.request.args)
asf_id_for_template: str | None = None
@@ -475,7 +475,7 @@ async def ldap_search() -> str:
@admin.BLUEPRINT.route("/ongoing-tasks/<project_name>/<version_name>/<revision>")
-async def ongoing_tasks(project_name: str, version_name: str, revision: str) -> quart.wrappers.response.Response:
+async def admin_ongoing_tasks(project_name: str, version_name: str, revision: str) -> quart.wrappers.response.Response:
try:
ongoing = await interaction.tasks_ongoing(project_name, version_name, revision)
return quart.Response(str(ongoing), mimetype="text/plain")
diff --git a/atr/blueprints/admin/templates/ldap-lookup.html b/atr/blueprints/admin/templates/ldap-lookup.html
index cbecd9a..41e6152 100644
--- a/atr/blueprints/admin/templates/ldap-lookup.html
+++ b/atr/blueprints/admin/templates/ldap-lookup.html
@@ -17,7 +17,7 @@
<h5 class="mb-0">Search criteria</h5>
</div>
<div class="card-body">
- <form method="get" action="{{ url_for('admin.ldap_search') }}">
+ <form method="get" action="{{ url_for('admin.admin_ldap') }}">
{{ form.csrf_token }}
<div class="mb-3">
{{ form.uid.label(class="form-label") }}
diff --git a/atr/routes/published.py b/atr/routes/published.py
index fd5d251..a3d9ed7 100644
--- a/atr/routes/published.py
+++ b/atr/routes/published.py
@@ -40,18 +40,6 @@ async def root(session: routes.CommitterSession) -> quart.Response:
return await _path(session, "")
-async def _path(session: routes.CommitterSession, path: str) -> quart.Response:
- downloads_path = util.get_downloads_dir()
- full_path = downloads_path / path
- if await aiofiles.os.path.isdir(full_path):
- return await _directory_listing(full_path, path)
-
- if await aiofiles.os.path.isfile(full_path):
- return await _file_content(full_path)
-
- return quart.abort(404)
-
-
async def _directory_listing(full_path: pathlib.Path, current_path: str) -> quart.Response:
html_parts = [
"<!doctype html>",
@@ -101,3 +89,15 @@ async def _directory_listing(full_path: pathlib.Path, current_path: str) -> quar
async def _file_content(full_path: pathlib.Path) -> quart.Response:
return await quart.send_file(full_path)
+
+
+async def _path(session: routes.CommitterSession, path: str) -> quart.Response:
+ downloads_path = util.get_downloads_dir()
+ full_path = downloads_path / path
+ if await aiofiles.os.path.isdir(full_path):
+ return await _directory_listing(full_path, path)
+
+ if await aiofiles.os.path.isfile(full_path):
+ return await _file_content(full_path)
+
+ return quart.abort(404)
diff --git a/atr/template.py b/atr/template.py
index 0a57a1b..e461e08 100644
--- a/atr/template.py
+++ b/atr/template.py
@@ -23,6 +23,21 @@ import quart
import quart.app as app
import quart.signals as signals
+render_async = quart.render_template
+
+
+async def render_sync(
+ template_name_or_list: str | jinja2.Template | list[str | jinja2.Template],
+ **context_vars: Any,
+) -> str:
+ app_instance = quart.current_app
+ await app_instance.update_template_context(context_vars)
+ template = app_instance.jinja_env.get_or_select_template(template_name_or_list)
+ return await _render_in_thread(template, context_vars, app_instance)
+
+
+render = render_sync
+
async def _render_in_thread(template: jinja2.Template, context: dict, app: app.Quart) -> str:
if template.environment.is_async is False:
@@ -41,19 +56,3 @@ async def _render_in_thread(template: jinja2.Template, context: dict, app: app.Q
context=context,
)
return rendered_template
-
-
-render_async = quart.render_template
-
-
-async def render_sync(
- template_name_or_list: str | jinja2.Template | list[str | jinja2.Template],
- **context_vars: Any,
-) -> str:
- app_instance = quart.current_app
- await app_instance.update_template_context(context_vars)
- template = app_instance.jinja_env.get_or_select_template(template_name_or_list)
- return await _render_in_thread(template, context_vars, app_instance)
-
-
-render = render_sync
diff --git a/atr/templates/includes/sidebar.html b/atr/templates/includes/sidebar.html
index e5c568b..acef5be 100644
--- a/atr/templates/includes/sidebar.html
+++ b/atr/templates/includes/sidebar.html
@@ -153,8 +153,8 @@
</li>
<li>
<i class="bi bi-person-plus"></i>
- <a href="{{ url_for('admin.ldap_search') }}"
- {% if request.endpoint == 'admin.ldap_search' %}class="active"{% endif %}>LDAP search</a>
+ <a href="{{ url_for('admin.admin_ldap') }}"
+ {% if request.endpoint == 'admin.admin_ldap' %}class="active"{% endif %}>LDAP search</a>
</li>
<li>
<i class="bi bi-speedometer2"></i>
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@tooling.apache.org
For additional commands, e-mail: commits-help@tooling.apache.org