You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@security.apache.org by en...@apache.org on 2026/09/16 14:31:59 UTC
(security-dash) branch backend-api updated: move data classes to own file
This is an automated email from the ASF dual-hosted git repository.
raboof pushed a commit to branch backend-api
in repository https://gitbox.apache.org/repos/asf/security-dash.git
The following commit(s) were added to refs/heads/backend-api by this push:
new 531f2c7 move data classes to own file
531f2c7 is described below
commit 531f2c789d100dc9b8507ec4c7c561442bbb4d24
Author: Arnout Engelen <ar...@bzzt.net>
AuthorDate: Wed Sep 16 16:31:41 2026 +0200
move data classes to own file
---
app/__init__.py | 16 +---------------
app/mail.py | 2 +-
app/model.py | 34 ++++++++++++++++++++++++++++++++++
3 files changed, 36 insertions(+), 16 deletions(-)
diff --git a/app/__init__.py b/app/__init__.py
index 5e59228..83c8907 100644
--- a/app/__init__.py
+++ b/app/__init__.py
@@ -18,9 +18,9 @@
"""Security issue dashboard API for the Apache Software Foundation"""
from app.config import AppConfig
+from app.model import AcceptReport, RejectReport
from app import config
import asfquart
-import dataclasses
from app.mail import accept_email, reject_email, send_email, valid_pmc, valid_sender
import json
import os
@@ -41,20 +41,6 @@ API = quart.Blueprint(
url_prefix="/",
)
-@dataclasses.dataclass
-class AcceptReport:
- sender: str
- tag: str
- message_id: str
- response: str
-
-@dataclasses.dataclass
-class RejectReport:
- sender: str
- tag: str
- message_id: str
- response: str
-
def _get_report_info(tag: str, _message_id: str):
"""Path to the report file. Raises if the tag points outside the data directory."""
data_dir = config.get().data_dir_path.resolve()
diff --git a/app/mail.py b/app/mail.py
index 3a14ec1..67b6ecb 100644
--- a/app/mail.py
+++ b/app/mail.py
@@ -24,7 +24,7 @@ from typing import Final
import aiosmtplib
from app import config
-from app import AcceptReport, RejectReport, config
+from app.model import AcceptReport, RejectReport
_SMTP_TIMEOUT: Final[int] = 30
_CONTROL = re.compile(r"[\x00-\x08\x0b\x0c\x0e-\x1f\x7f-\x9f]")
diff --git a/app/model.py b/app/model.py
new file mode 100644
index 0000000..20ff27e
--- /dev/null
+++ b/app/model.py
@@ -0,0 +1,34 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+import dataclasses
+
+@dataclasses.dataclass
+class AcceptReport:
+ sender: str
+ tag: str
+ message_id: str
+ response: str
+
+@dataclasses.dataclass
+class RejectReport:
+ sender: str
+ tag: str
+ message_id: str
+ response: str
+
+