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 b8756de  Add the form to regenerate a KEYS file to committee pages
b8756de is described below

commit b8756de95a93b28636ffbc5c5749d61170990908
Author: Sean B. Palmer <[email protected]>
AuthorDate: Tue Jun 17 19:18:55 2025 +0100

    Add the form to regenerate a KEYS file to committee pages
---
 atr/routes/committees.py          |  7 +++++++
 atr/routes/keys.py                |  2 +-
 atr/templates/committee-view.html | 10 ++++++++++
 3 files changed, 18 insertions(+), 1 deletion(-)

diff --git a/atr/routes/committees.py b/atr/routes/committees.py
index a0bb45f..372d7d6 100644
--- a/atr/routes/committees.py
+++ b/atr/routes/committees.py
@@ -20,6 +20,8 @@
 import datetime
 import http.client
 
+import wtforms
+
 import atr.db as db
 import atr.db.models as models
 import atr.routes as routes
@@ -41,6 +43,10 @@ async def directory() -> str:
 
 @routes.public("/committees/<name>")
 async def view(name: str) -> str:
+    # TODO: Could also import this from keys.py
+    class UpdateCommitteeKeysForm(util.QuartFormTyped):
+        submit = wtforms.SubmitField("Regenerate KEYS file")
+
     async with db.session() as data:
         committee = await data.committee(name=name, _projects=True, 
_public_signing_keys=True).demand(
             http.client.HTTPException(404)
@@ -51,4 +57,5 @@ async def view(name: str) -> str:
             algorithms=routes.algorithms,
             now=datetime.datetime.now(datetime.UTC),
             email_from_key=util.email_from_uid,
+            update_committee_keys_form=await 
UpdateCommitteeKeysForm.create_form(),
         )
diff --git a/atr/routes/keys.py b/atr/routes/keys.py
index bb922ff..d249308 100644
--- a/atr/routes/keys.py
+++ b/atr/routes/keys.py
@@ -440,7 +440,7 @@ async def update_committee_keys(session: 
routes.CommitterSession, committee_name
     if error_msg:
         await quart.flash(error_msg, "error")
     else:
-        await quart.flash(f"Successfully updated KEYS file for committee 
{committee_name}.", "success")
+        await quart.flash(f'Successfully regenerated the KEYS file for the 
"{committee_name}" committee.', "success")
 
     return await session.redirect(keys)
 
diff --git a/atr/templates/committee-view.html 
b/atr/templates/committee-view.html
index 915f927..bc8c133 100644
--- a/atr/templates/committee-view.html
+++ b/atr/templates/committee-view.html
@@ -72,6 +72,16 @@
             </tbody>
           </table>
         </div>
+        <p class="text-muted">
+          The <code>KEYS</code> file is automatically generated when you add 
or remove a key, but you can also use the form below to manually regenerate it.
+        </p>
+        <form method="post"
+              action="{{ as_url(routes.keys.update_committee_keys, 
committee_name=committee.name) }}"
+              class="mb-4 d-inline-block">
+          {{ update_committee_keys_form.hidden_tag() }}
+
+          {{ update_committee_keys_form.submit(class_='btn btn-sm 
btn-outline-secondary') }}
+        </form>
       {% else %}
         <p class="mb-4">No keys uploaded for this committee yet.</p>
       {% endif %}


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

Reply via email to