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 3befc1c Rename files routes to candidate draft routes
3befc1c is described below
commit 3befc1ce150747e4a1068e0e6bebf233ad13a5a9
Author: Sean B. Palmer <[email protected]>
AuthorDate: Wed Mar 26 15:40:26 2025 +0200
Rename files routes to candidate draft routes
---
atr/routes/{files.py => candidate_draft.py} | 54 +++++++++++++---------
atr/server.py | 4 +-
...oject.html => candidate-draft-add-project.html} | 2 +-
.../{files-add.html => candidate-draft-add.html} | 4 +-
...files-check.html => candidate-draft-check.html} | 2 +-
.../{files-list.html => candidate-draft-list.html} | 10 ++--
...files-tools.html => candidate-draft-tools.html} | 8 ++--
atr/templates/includes/sidebar.html | 4 +-
8 files changed, 48 insertions(+), 40 deletions(-)
diff --git a/atr/routes/files.py b/atr/routes/candidate_draft.py
similarity index 92%
rename from atr/routes/files.py
rename to atr/routes/candidate_draft.py
index 1ede576..5b91b84 100644
--- a/atr/routes/files.py
+++ b/atr/routes/candidate_draft.py
@@ -15,7 +15,7 @@
# specific language governing permissions and limitations
# under the License.
-"""files.py"""
+"""candidate_draft.py"""
from __future__ import annotations
@@ -254,8 +254,8 @@ def committer_route(
return decorator
-@committer_route("/files/add")
-async def root_files_add(session: CommitterSession) -> str:
+@committer_route("/candidate/draft/add")
+async def root_candidate_draft_add(session: CommitterSession) -> str:
"""Show a page to allow the user to rsync files to candidate drafts."""
# Do them outside of the template rendering call to ensure order
# The user_candidate_drafts call can use cached results from user_projects
@@ -263,7 +263,7 @@ async def root_files_add(session: CommitterSession) -> str:
user_candidate_drafts = await session.user_candidate_drafts
return await quart.render_template(
- "files-add.html",
+ "candidate-draft-add.html",
asf_id=session.uid,
projects=user_projects,
server_domain=session.host,
@@ -300,8 +300,8 @@ async def _add_one(
await f.write(chunk)
-@committer_route("/files/add/<project_name>/<version_name>", methods=["GET",
"POST"])
-async def root_files_add_project(
+@committer_route("/candidate/draft/add/<project_name>/<version_name>",
methods=["GET", "POST"])
+async def root_candidate_draft_add_project(
session: CommitterSession, project_name: str, version_name: str
) -> response.Response | str:
"""Show a page to allow the user to add a single file to a candidate
draft."""
@@ -318,14 +318,14 @@ async def root_files_add_project(
await _add_one(project_name, version_name, file_path, file_data)
await quart.flash("File added successfully", "success")
return quart.redirect(
- quart.url_for("root_files_list", project_name=project_name,
version_name=version_name)
+ quart.url_for("root_candidate_draft_list",
project_name=project_name, version_name=version_name)
)
except Exception as e:
logging.exception("Error adding file:")
await quart.flash(f"Error adding file: {e!s}", "error")
return await quart.render_template(
- "files-add-project.html",
+ "candidate-draft-add-project.html",
asf_id=session.uid,
server_domain=session.host,
project_name=project_name,
@@ -334,8 +334,8 @@ async def root_files_add_project(
)
-@committer_route("/files/list/<project_name>/<version_name>")
-async def root_files_list(session: CommitterSession, project_name: str,
version_name: str) -> str:
+@committer_route("/candidate/draft/list/<project_name>/<version_name>")
+async def root_candidate_draft_list(session: CommitterSession, project_name:
str, version_name: str) -> str:
"""Show all the files in the rsync upload directory for a release."""
# Check that the user has access to the project
if not any((p.name == project_name) for p in (await
session.user_projects)):
@@ -395,7 +395,7 @@ async def root_files_list(session: CommitterSession,
project_name: str, version_
path_tasks[path] = await db.recent_tasks(data,
f"{project_name}-{version_name}", str(path), path_modified[path])
return await quart.render_template(
- "files-list.html",
+ "candidate-draft-list.html",
asf_id=session.uid,
project_name=project_name,
version_name=version_name,
@@ -414,8 +414,10 @@ async def root_files_list(session: CommitterSession,
project_name: str, version_
)
-@committer_route("/files/checks/<project_name>/<version_name>/<path:file_path>")
-async def root_files_checks(session: CommitterSession, project_name: str,
version_name: str, file_path: str) -> str:
+@committer_route("/candidate/draft/checks/<project_name>/<version_name>/<path:file_path>")
+async def root_candidate_draft_checks(
+ session: CommitterSession, project_name: str, version_name: str,
file_path: str
+) -> str:
"""Show the status of all checks for a specific file."""
# Check that the user has access to the project
if not any((p.name == project_name) for p in (await
session.user_projects)):
@@ -453,7 +455,7 @@ async def root_files_checks(session: CommitterSession,
project_name: str, versio
}
return await quart.render_template(
- "files-check.html",
+ "candidate-draft-check.html",
project_name=project_name,
version_name=version_name,
file_path=file_path,
@@ -465,8 +467,10 @@ async def root_files_checks(session: CommitterSession,
project_name: str, versio
)
-@committer_route("/files/tools/<project_name>/<version_name>/<path:file_path>")
-async def root_files_tools(session: CommitterSession, project_name: str,
version_name: str, file_path: str) -> str:
+@committer_route("/candidate/draft/tools/<project_name>/<version_name>/<path:file_path>")
+async def root_candidate_draft_tools(
+ session: CommitterSession, project_name: str, version_name: str,
file_path: str
+) -> str:
"""Show the tools for a specific file."""
# Check that the user has access to the project
if not any((p.name == project_name) for p in (await
session.user_projects)):
@@ -494,7 +498,7 @@ async def root_files_tools(session: CommitterSession,
project_name: str, version
}
return await quart.render_template(
- "files-tools.html",
+ "candidate-draft-tools.html",
project_name=project_name,
version_name=version_name,
file_path=file_path,
@@ -504,8 +508,8 @@ async def root_files_tools(session: CommitterSession,
project_name: str, version
)
-@committer_route("/files/delete/<project_name>/<version_name>/<path:file_path>",
methods=["POST"])
-async def root_files_delete(
+@committer_route("/candidate/draft/delete/<project_name>/<version_name>/<path:file_path>",
methods=["POST"])
+async def root_candidate_draft_delete(
session: CommitterSession, project_name: str, version_name: str,
file_path: str
) -> response.Response:
"""Delete a specific file from the release candidate."""
@@ -529,11 +533,13 @@ async def root_files_delete(
await aiofiles.os.remove(full_path)
await quart.flash("File deleted successfully", "success")
- return quart.redirect(quart.url_for("root_files_list",
project_name=project_name, version_name=version_name))
+ return quart.redirect(
+ quart.url_for("root_candidate_draft_list", project_name=project_name,
version_name=version_name)
+ )
-@committer_route("/files/generate-hash/<project_name>/<version_name>/<path:file_path>",
methods=["POST"])
-async def root_files_generate_hash(
+@committer_route("/candidate/draft/generate-hash/<project_name>/<version_name>/<path:file_path>",
methods=["POST"])
+async def root_candidate_draft_generate_hash(
session: CommitterSession, project_name: str, version_name: str,
file_path: str
) -> response.Response:
"""Generate an sha256 or sha512 hash file for a candidate draft file."""
@@ -585,4 +591,6 @@ async def root_files_generate_hash(
await data.commit()
await quart.flash(f"{hash_type} file generated successfully", "success")
- return quart.redirect(quart.url_for("root_files_list",
project_name=project_name, version_name=version_name))
+ return quart.redirect(
+ quart.url_for("root_candidate_draft_list", project_name=project_name,
version_name=version_name)
+ )
diff --git a/atr/server.py b/atr/server.py
index c9e7b0a..9f82a68 100644
--- a/atr/server.py
+++ b/atr/server.py
@@ -58,11 +58,11 @@ class ApiOnlyOpenAPIProvider(quart_schema.OpenAPIProvider):
def register_routes(app: base.QuartApp) -> tuple[str, ...]:
# NOTE: These imports are for their side effects only
import atr.routes.candidate as candidate
+ import atr.routes.candidate_draft as candidate_draft
import atr.routes.committees as committees
import atr.routes.dev as dev
import atr.routes.docs as docs
import atr.routes.download as download
- import atr.routes.files as files
import atr.routes.keys as keys
import atr.routes.projects as projects
import atr.routes.release as release
@@ -95,11 +95,11 @@ def register_routes(app: base.QuartApp) -> tuple[str, ...]:
# Must do this otherwise ruff "fixes" this function by removing the imports
return (
candidate.__name__,
+ candidate_draft.__name__,
committees.__name__,
dev.__name__,
docs.__name__,
download.__name__,
- files.__name__,
keys.__name__,
projects.__name__,
release.__name__,
diff --git a/atr/templates/files-add-project.html
b/atr/templates/candidate-draft-add-project.html
similarity index 95%
rename from atr/templates/files-add-project.html
rename to atr/templates/candidate-draft-add-project.html
index d68f1b5..d27d4f3 100644
--- a/atr/templates/files-add-project.html
+++ b/atr/templates/candidate-draft-add-project.html
@@ -9,7 +9,7 @@
{% endblock description %}
{% block content %}
- <a href="{{ url_for('root_files_add') }}" class="back-link">← Back to Create
and modify</a>
+ <a href="{{ url_for('root_candidate_draft_add') }}" class="back-link">← Back
to Create and modify</a>
<h1>Add file to {{ project_name }} {{ version_name }}</h1>
<p class="intro">Use this form to add a single file to this candidate
draft.</p>
diff --git a/atr/templates/files-add.html
b/atr/templates/candidate-draft-add.html
similarity index 95%
rename from atr/templates/files-add.html
rename to atr/templates/candidate-draft-add.html
index ebddc46..68b9fcb 100644
--- a/atr/templates/files-add.html
+++ b/atr/templates/candidate-draft-add.html
@@ -34,11 +34,11 @@
{% endif %}
<p class="card-text">
{% if number_of_release_files(release) > 0 %}
- This candidate draft has <a href="{{
url_for('root_files_list', project_name=release.project.name,
version_name=release.version) }}">{{ number_of_release_files(release) }}
file(s)</a>.
+ This candidate draft has <a href="{{
url_for('root_candidate_draft_list', project_name=release.project.name,
version_name=release.version) }}">{{ number_of_release_files(release) }}
file(s)</a>.
{% else %}
This candidate draft doesn't have any files yet.
{% endif %}
- <a href="{{ url_for('root_files_add_project',
project_name=release.project.name, version_name=release.version) }}">Upload a
file using the browser</a>,
+ <a href="{{ url_for('root_candidate_draft_add_project',
project_name=release.project.name, version_name=release.version) }}">Upload a
file using the browser</a>,
or use the command below to add or modify files in this draft:
</p>
</div>
diff --git a/atr/templates/files-check.html
b/atr/templates/candidate-draft-check.html
similarity index 98%
rename from atr/templates/files-check.html
rename to atr/templates/candidate-draft-check.html
index 1e3d97c..2813b44 100644
--- a/atr/templates/files-check.html
+++ b/atr/templates/candidate-draft-check.html
@@ -9,7 +9,7 @@
{% endblock description %}
{% block content %}
- <a href="{{ url_for('root_files_list', project_name=project_name,
version_name=version_name) }}"
+ <a href="{{ url_for('root_candidate_draft_list', project_name=project_name,
version_name=version_name) }}"
class="back-link">← Back to Files List</a>
<div class="p-3 mb-4 bg-light border rounded">
diff --git a/atr/templates/files-list.html
b/atr/templates/candidate-draft-list.html
similarity index 92%
rename from atr/templates/files-list.html
rename to atr/templates/candidate-draft-list.html
index d0fcb8b..275002c 100644
--- a/atr/templates/files-list.html
+++ b/atr/templates/candidate-draft-list.html
@@ -49,7 +49,7 @@
<div class="card mb-4">
<div class="card-header d-flex justify-content-between align-items-center">
<h5 class="mb-0">Files</h5>
- <a href="{{ url_for('root_files_add') }}"
+ <a href="{{ url_for('root_candidate_draft_add') }}"
class="btn btn-sm btn-outline-secondary">Back to Create and modify</a>
</div>
<div class="card-body">
@@ -127,10 +127,10 @@
<td class="atr-sans">
<a href="{{ url_for('root_download',
phase='candidate-draft', project=release.project.name, version=release.version,
path=path) }}"
class="btn btn-sm btn-outline-primary fs-6">Download</a>
- <a href="{{ url_for('root_files_tools',
project_name=project_name, version_name=version_name, file_path=path) }}"
+ <a href="{{ url_for('root_candidate_draft_tools',
project_name=project_name, version_name=version_name, file_path=path) }}"
class="btn btn-sm btn-outline-primary fs-6 small
ms-2">Tools</a>
{% if path in tasks and tasks[path]|length > 0 %}
- <a href="{{ url_for('root_files_checks',
project_name=project_name, version_name=version_name, file_path=path) }}"
+ <a href="{{ url_for('root_candidate_draft_checks',
project_name=project_name, version_name=version_name, file_path=path) }}"
class="btn btn-sm btn-outline-primary fs-6 small
ms-2">Check results</a>
{% endif %}
</td>
@@ -173,7 +173,7 @@
</details>
{% else %}
<div class="alert alert-info">
- This release does not have any files yet. You can add files using
rsync from the <a href="{{ url_for('root_files_add') }}">add files</a> page.
+ This release does not have any files yet. You can add files using
rsync from the <a href="{{ url_for('root_candidate_draft_add') }}">add
files</a> page.
</div>
{% endif %}
</div>
@@ -185,7 +185,7 @@
</div>
<div class="card-body">
<p>
- <a href="{{ url_for('root_files_add_project',
project_name=release.project.name, version_name=release.version) }}">Upload a
file in the browser</a>, or use the command below to add or modify files in
this release using rsync:
+ <a href="{{ url_for('root_candidate_draft_add_project',
project_name=release.project.name, version_name=release.version) }}">Upload a
file in the browser</a>, or use the command below to add or modify files in
this release using rsync:
</p>
</div>
<pre class="card-footer bg-light border-1 pt-4 small">
diff --git a/atr/templates/files-tools.html
b/atr/templates/candidate-draft-tools.html
similarity index 77%
rename from atr/templates/files-tools.html
rename to atr/templates/candidate-draft-tools.html
index f000633..787c2d9 100644
--- a/atr/templates/files-tools.html
+++ b/atr/templates/candidate-draft-tools.html
@@ -9,7 +9,7 @@
{% endblock description %}
{% block content %}
- <a href="{{ url_for('root_files_list', project_name=project_name,
version_name=version_name) }}"
+ <a href="{{ url_for('root_candidate_draft_list', project_name=project_name,
version_name=version_name) }}"
class="back-link">← Back to Files List</a>
<div class="p-3 mb-4 bg-light border rounded">
@@ -35,12 +35,12 @@
</div>
<div class="d-flex gap-2 mb-4">
<form method="post"
- action="{{ url_for('root_files_generate_hash',
project_name=project_name, version_name=version_name, file_path=file_path) }}">
+ action="{{ url_for('root_candidate_draft_generate_hash',
project_name=project_name, version_name=version_name, file_path=file_path) }}">
<input type="hidden" name="hash_type" value="sha256" />
<button type="submit" class="btn btn-outline-secondary">Generate
SHA256</button>
</form>
<form method="post"
- action="{{ url_for('root_files_generate_hash',
project_name=project_name, version_name=version_name, file_path=file_path) }}">
+ action="{{ url_for('root_candidate_draft_generate_hash',
project_name=project_name, version_name=version_name, file_path=file_path) }}">
<input type="hidden" name="hash_type" value="sha512" />
<button type="submit" class="btn btn-outline-secondary">Generate
SHA512</button>
</form>
@@ -49,7 +49,7 @@
<h3>Delete file</h3>
<p>This tool deletes the file from the candidate draft.</p>
<form method="post"
- action="{{ url_for('root_files_delete', project_name=project_name,
version_name=version_name, file_path=file_path) }}">
+ action="{{ url_for('root_candidate_draft_delete',
project_name=project_name, version_name=version_name, file_path=file_path) }}">
<button type="submit"
class="btn btn-danger"
onclick="return confirm('Are you sure you want to delete this
file?')">Delete file</button>
diff --git a/atr/templates/includes/sidebar.html
b/atr/templates/includes/sidebar.html
index 411e1b1..622147a 100644
--- a/atr/templates/includes/sidebar.html
+++ b/atr/templates/includes/sidebar.html
@@ -50,8 +50,8 @@
<h3>Candidate drafts</h3>
<ul>
<li>
- <a href="{{ url_for('root_files_add') }}"
- {% if request.endpoint == 'root_files_add' %}class="active"{%
endif %}>Create and modify</a>
+ <a href="{{ url_for('root_candidate_draft_add') }}"
+ {% if request.endpoint == 'root_candidate_draft_add'
%}class="active"{% endif %}>Create and modify</a>
</li>
<!-- TODO: Don't show this if the user doesn't have any release
candidates? -->
<li>
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]