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 921ba74 Update a form to use its already implemented more type safe
version
921ba74 is described below
commit 921ba74bb41af394236173ffe70802210665bb34
Author: Sean B. Palmer <[email protected]>
AuthorDate: Sun Nov 16 19:21:09 2025 +0000
Update a form to use its already implemented more type safe version
---
atr/get/committees.py | 15 +++++++++------
atr/templates/committee-view.html | 10 +---------
2 files changed, 10 insertions(+), 15 deletions(-)
diff --git a/atr/get/committees.py b/atr/get/committees.py
index 15b6ffb..9036749 100644
--- a/atr/get/committees.py
+++ b/atr/get/committees.py
@@ -21,18 +21,15 @@ import asfquart.base as base
import atr.blueprints.get as get
import atr.db as db
-import atr.forms as forms
+import atr.form as form
import atr.models.sql as sql
+import atr.post as post
import atr.shared as shared
import atr.template as template
import atr.util as util
import atr.web as web
-class UpdateCommitteeKeysForm(forms.Typed):
- submit = forms.submit("Regenerate KEYS file")
-
-
@get.public("/committees")
async def directory(session: web.Committer | None) -> str:
"""Main committee directory page."""
@@ -65,6 +62,12 @@ async def view(session: web.Committer | None, name: str) ->
str:
algorithms=shared.algorithms,
now=datetime.datetime.now(datetime.UTC),
email_from_key=util.email_from_uid,
- update_committee_keys_form=await UpdateCommitteeKeysForm.create_form(),
+ update_committee_keys_form=form.render(
+ model_cls=shared.keys.UpdateCommitteeKeysForm,
+ action=util.as_url(post.keys.keys),
+ submit_label="Regenerate KEYS file",
+ defaults={"committee_name": name},
+ empty=True,
+ ),
is_standing=util.committee_is_standing(name),
)
diff --git a/atr/templates/committee-view.html
b/atr/templates/committee-view.html
index 275f9aa..43cb28d 100644
--- a/atr/templates/committee-view.html
+++ b/atr/templates/committee-view.html
@@ -76,15 +76,7 @@
<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(post.keys.keys) }}"
- class="mb-4 d-inline-block">
- {{ update_committee_keys_form.hidden_tag() }}
- <input type="hidden" name="variant" value="update_committee_keys"
/>
- <input type="hidden" name="committee_name" value="{{
committee.name }}" />
-
- {{ update_committee_keys_form.submit(class_='btn btn-sm
btn-outline-secondary') }}
- </form>
+ {{ update_committee_keys_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]