aboutsummaryrefslogtreecommitdiff
path: root/webmentions_ssg
diff options
context:
space:
mode:
authorDennis Fink2026-11-13 08:08:04 +0100
committerDennis Fink2026-11-13 08:08:04 +0100
commita227ec62b1cb0d5a4bb840072173607879e5d2f8 (patch)
treee19e01d1481747a05432bb3acfb93d9009710ba4 /webmentions_ssg
parenta71c9fbeb034a5a8c545c8e19679f0eb86703321 (diff)
downloadwebmentions-ssg-a227ec62b1cb0d5a4bb840072173607879e5d2f8.tar.gz
webmentions-ssg-a227ec62b1cb0d5a4bb840072173607879e5d2f8.zip
refactor(core): use EAFP for user creation
Rely on the database uniqueness constraint and existing `IntegrityError` handling instead of performing a redundant pre-insert user lookup.
Diffstat (limited to '')
-rw-r--r--webmentions_ssg/cli.py3
1 files changed, 0 insertions, 3 deletions
diff --git a/webmentions_ssg/cli.py b/webmentions_ssg/cli.py
index b0459d4..7a68651 100644
--- a/webmentions_ssg/cli.py
+++ b/webmentions_ssg/cli.py
@@ -47,9 +47,6 @@ def create_user(username: str, password: str) -> None:
except ValueError as exc:
raise click.ClickException(str(exc)) from exc
- if db.session.scalar(sa.select(User).where(User.username == username)):
- raise click.ClickException(f"User {username!r} already exists.")
-
db.session.add(User(username=username, password=password))
try:
db.session.commit()