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 0edea35  Fix route order in keys.py and add a Makefile helper for 
obvious fixes
0edea35 is described below

commit 0edea3533e329c29ff47f76cc43431edf7af6b83
Author: Sean B. Palmer <[email protected]>
AuthorDate: Wed Mar 26 14:05:09 2025 +0200

    Fix route order in keys.py and add a Makefile helper for obvious fixes
---
 Makefile           |  9 +++++++-
 atr/routes/keys.py | 64 +++++++++++++++++++++++++++---------------------------
 2 files changed, 40 insertions(+), 33 deletions(-)

diff --git a/Makefile b/Makefile
index 4cbdf66..4f3e4b3 100644
--- a/Makefile
+++ b/Makefile
@@ -1,4 +1,4 @@
-.PHONY: build build-alpine build-ubuntu certs check docs generate-version 
report run stop serve sync sync-dev
+.PHONY: build build-alpine build-ubuntu certs check docs generate-version 
obvfix report run stop serve sync sync-dev
 
 BIND ?= 127.0.0.1:8080
 PYTHON ?= $(which python3)
@@ -33,6 +33,13 @@ generate-version:
        @mv /tmp/_version.py atr/_version.py
        @cat atr/_version.py
 
+obvfix:
+       git add -A
+       make check || make check
+       git commit
+       git pull
+       git push
+
 report:
        @echo SCRIPTS = $(SCRIPTS)
 
diff --git a/atr/routes/keys.py b/atr/routes/keys.py
index 6377708..ab0e0f4 100644
--- a/atr/routes/keys.py
+++ b/atr/routes/keys.py
@@ -245,38 +245,6 @@ async def root_keys_add() -> str:
     )
 
 
[email protected]_route("/keys/ssh/add", methods=["GET", "POST"])
[email protected](auth.Requirements.committer)
-async def root_keys_ssh_add() -> response.Response | str:
-    """Add a new SSH key to the user's account."""
-    # TODO: Make an auth.require wrapper that gives the session automatically
-    # And the form if it's a POST handler? Might be hard to type
-    # But we can use variants of the function
-    # GET, POST, GET_POST are all we need
-    # We could even include auth in the function names
-    web_session = await session.read()
-    if web_session is None:
-        raise base.ASFQuartException("Not authenticated", errorcode=401)
-
-    form = await AddSSHKeyForm.create_form()
-    fingerprint = None
-    if await form.validate_on_submit():
-        key: str = util.unwrap(form.key.data)
-        fingerprint = await asyncio.to_thread(key_ssh_fingerprint, key)
-        async with db.session() as data:
-            async with data.begin():
-                data.add(models.SSHKey(fingerprint=fingerprint, key=key, 
asf_uid=util.unwrap(web_session.uid)))
-        await quart.flash(f"SSH key added successfully: {fingerprint}", 
"success")
-        return quart.redirect(quart.url_for("root_keys_review"))
-
-    return await quart.render_template(
-        "keys-ssh-add.html",
-        asf_id=web_session.uid,
-        form=form,
-        fingerprint=fingerprint,
-    )
-
-
 @routes.app_route("/keys/delete", methods=["POST"])
 @auth.require(auth.Requirements.committer)
 async def root_keys_delete() -> response.Response:
@@ -342,3 +310,35 @@ async def root_keys_review() -> str:
         status_type=status_type,
         now=datetime.datetime.now(datetime.UTC),
     )
+
+
[email protected]_route("/keys/ssh/add", methods=["GET", "POST"])
[email protected](auth.Requirements.committer)
+async def root_keys_ssh_add() -> response.Response | str:
+    """Add a new SSH key to the user's account."""
+    # TODO: Make an auth.require wrapper that gives the session automatically
+    # And the form if it's a POST handler? Might be hard to type
+    # But we can use variants of the function
+    # GET, POST, GET_POST are all we need
+    # We could even include auth in the function names
+    web_session = await session.read()
+    if web_session is None:
+        raise base.ASFQuartException("Not authenticated", errorcode=401)
+
+    form = await AddSSHKeyForm.create_form()
+    fingerprint = None
+    if await form.validate_on_submit():
+        key: str = util.unwrap(form.key.data)
+        fingerprint = await asyncio.to_thread(key_ssh_fingerprint, key)
+        async with db.session() as data:
+            async with data.begin():
+                data.add(models.SSHKey(fingerprint=fingerprint, key=key, 
asf_uid=util.unwrap(web_session.uid)))
+        await quart.flash(f"SSH key added successfully: {fingerprint}", 
"success")
+        return quart.redirect(quart.url_for("root_keys_review"))
+
+    return await quart.render_template(
+        "keys-ssh-add.html",
+        asf_id=web_session.uid,
+        form=form,
+        fingerprint=fingerprint,
+    )


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to