diff options
| author | Dennis Fink | 2026-11-17 17:09:59 +0100 |
|---|---|---|
| committer | Dennis Fink | 2026-11-17 17:09:59 +0100 |
| commit | 6d6d079a3a99d3d3a922a640b6925eb2adf044de (patch) | |
| tree | 33cc19241f4ce86ea43b2f194087c58e3fdc8a4d /webmentions_ssg/views/endpoint.py | |
| parent | 227092b57acc886469e16bcc4c0d3256e86d3d1e (diff) | |
| download | webmentions-ssg-6d6d079a3a99d3d3a922a640b6925eb2adf044de.tar.gz webmentions-ssg-6d6d079a3a99d3d3a922a640b6925eb2adf044de.zip | |
refactor(core)!: split forms and models by feature
Replace monolithic form and model modules with focused packages for
receiver, moderation, source, user, and shared validation concerns.
Rename source policy concepts to domain moderation, including routes,
models, tables, configuration, templates, and tests.
BREAKING CHANGE: form and model import paths, moderation routes, and
`SOURCE_ALLOWLIST_ENABLED` have changed; use `ALLOWLIST_ENABLED` and the
new feature-specific modules.
Diffstat (limited to '')
| -rw-r--r-- | webmentions_ssg/views/endpoint.py | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/webmentions_ssg/views/endpoint.py b/webmentions_ssg/views/endpoint.py index 6d84d92..322e0f0 100644 --- a/webmentions_ssg/views/endpoint.py +++ b/webmentions_ssg/views/endpoint.py @@ -14,11 +14,12 @@ import sqlalchemy.exc as sa_exc from flask import Response, current_app, render_template, url_for from flask.typing import ResponseReturnValue -from .. import forms from ..db_helpers import rows_affected from ..extensions import csrf, db, limiter -from ..models import ReceivedWebmention, source_target_digest -from ..source_policy import source_rejection_reason +from ..forms.endpoint import WebmentionSubmissionForm +from ..models.received import ReceivedWebmention +from ..models.utils import source_target_digest +from ..moderation_policy import rejection_reason from ..tasks.verification import verify_webmention from .blueprint import webmentions_bp @@ -145,7 +146,7 @@ def receive_webmention() -> ResponseReturnValue: :returns: HTTP 201 response with the Webmention status URL in the ``Location`` header, or validation errors with HTTP 400. """ - form = forms.WebmentionSubmissionForm(meta={"csrf": False}) + form = WebmentionSubmissionForm(meta={"csrf": False}) if not form.validate_on_submit(): return form.errors, HTTPStatus.BAD_REQUEST @@ -153,7 +154,7 @@ def receive_webmention() -> ResponseReturnValue: source = cast(str, form.source.data) target = cast(str, form.target.data) - if reason := source_rejection_reason(source): + if reason := rejection_reason(source): return {"error": reason}, HTTPStatus.FORBIDDEN result = record_submission(source, target) |
