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 787d467 Require a label when making a new PAT
787d467 is described below
commit 787d4672baee3dbdb7d2fede251780199e31f102
Author: Sean B. Palmer <[email protected]>
AuthorDate: Mon Dec 29 15:27:09 2025 +0000
Require a label when making a new PAT
---
atr/post/tokens.py | 2 +-
atr/shared/tokens.py | 5 ++++-
2 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/atr/post/tokens.py b/atr/post/tokens.py
index 2e43ef2..ef5f755 100644
--- a/atr/post/tokens.py
+++ b/atr/post/tokens.py
@@ -64,7 +64,7 @@ async def _add_token(session: web.Committer, add_form:
shared.tokens.AddTokenFor
token_hash,
created,
expires,
- add_form.label or None,
+ add_form.label,
)
await web.flash_success(
diff --git a/atr/shared/tokens.py b/atr/shared/tokens.py
index 3bb9c9c..7e3925b 100644
--- a/atr/shared/tokens.py
+++ b/atr/shared/tokens.py
@@ -31,7 +31,10 @@ class AddTokenForm(form.Form):
@pydantic.field_validator("label", mode="after")
@classmethod
- def validate_label_length(cls, value: str) -> str:
+ def validate_label(cls, value: str) -> str:
+ value = value.strip()
+ if not value:
+ raise ValueError("Label is required")
if len(value) > 100:
raise ValueError("Label must be 100 characters or less")
return value
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]