mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-24 00:07:02 -04:00
isort .
This commit is contained in:
@@ -79,9 +79,6 @@ def handle_pagination(jobs, service_id, page):
|
|||||||
return prev_page, next_page, pagination
|
return prev_page, next_page, pagination
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def get_job_statistics(job, status):
|
def get_job_statistics(job, status):
|
||||||
statistics = job.get("statistics", [])
|
statistics = job.get("statistics", [])
|
||||||
for stat in statistics:
|
for stat in statistics:
|
||||||
|
|||||||
@@ -2,11 +2,11 @@ from flask import abort, flash, redirect, render_template, session, url_for
|
|||||||
from flask_login import current_user
|
from flask_login import current_user
|
||||||
from markupsafe import Markup
|
from markupsafe import Markup
|
||||||
|
|
||||||
|
from app.enums import InvitedOrgUserStatus, InvitedUserStatus
|
||||||
from app.main import main
|
from app.main import main
|
||||||
from app.models.organization import Organization
|
from app.models.organization import Organization
|
||||||
from app.models.service import Service
|
from app.models.service import Service
|
||||||
from app.models.user import InvitedOrgUser, InvitedUser, OrganizationUsers, User, Users
|
from app.models.user import InvitedOrgUser, InvitedUser, OrganizationUsers, User, Users
|
||||||
from app.enums import InvitedUserStatus, InvitedOrgUserStatus
|
|
||||||
|
|
||||||
|
|
||||||
@main.route("/invitation/<token>")
|
@main.route("/invitation/<token>")
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ from app import (
|
|||||||
organizations_client,
|
organizations_client,
|
||||||
service_api_client,
|
service_api_client,
|
||||||
)
|
)
|
||||||
|
from app.enums import VerificationStatus
|
||||||
from app.event_handlers import (
|
from app.event_handlers import (
|
||||||
create_archive_service_event,
|
create_archive_service_event,
|
||||||
create_resume_service_event,
|
create_resume_service_event,
|
||||||
@@ -52,7 +53,6 @@ from app.utils import DELIVERED_STATUSES, FAILURE_STATUSES, SENDING_STATUSES
|
|||||||
from app.utils.time import parse_naive_dt
|
from app.utils.time import parse_naive_dt
|
||||||
from app.utils.user import user_has_permissions, user_is_platform_admin
|
from app.utils.user import user_has_permissions, user_is_platform_admin
|
||||||
from notifications_python_client.errors import HTTPError
|
from notifications_python_client.errors import HTTPError
|
||||||
from app.enums import VerificationStatus
|
|
||||||
|
|
||||||
PLATFORM_ADMIN_SERVICE_PERMISSIONS = OrderedDict(
|
PLATFORM_ADMIN_SERVICE_PERMISSIONS = OrderedDict(
|
||||||
[
|
[
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ from flask import abort, current_app, request, session
|
|||||||
from flask_login import AnonymousUserMixin, UserMixin, login_user, logout_user
|
from flask_login import AnonymousUserMixin, UserMixin, login_user, logout_user
|
||||||
from werkzeug.utils import cached_property
|
from werkzeug.utils import cached_property
|
||||||
|
|
||||||
|
from app.enums import InvitedUserStatus
|
||||||
from app.event_handlers import (
|
from app.event_handlers import (
|
||||||
create_add_user_to_service_event,
|
create_add_user_to_service_event,
|
||||||
create_set_user_permissions_event,
|
create_set_user_permissions_event,
|
||||||
@@ -22,7 +23,6 @@ from app.utils.user_permissions import (
|
|||||||
translate_permissions_from_db_to_ui,
|
translate_permissions_from_db_to_ui,
|
||||||
)
|
)
|
||||||
from notifications_python_client.errors import HTTPError
|
from notifications_python_client.errors import HTTPError
|
||||||
from app.enums import InvitedUserStatus
|
|
||||||
|
|
||||||
|
|
||||||
def _get_service_id_from_view_args():
|
def _get_service_id_from_view_args():
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
from app.notify_client import NotifyAdminAPIClient, _attach_current_user
|
|
||||||
from app.enums import ApiKeyType
|
from app.enums import ApiKeyType
|
||||||
|
from app.notify_client import NotifyAdminAPIClient, _attach_current_user
|
||||||
|
|
||||||
# must match key types in notifications-api/app/models.py
|
# must match key types in notifications-api/app/models.py
|
||||||
KEY_TYPE_NORMAL = ApiKeyType.NORMAL
|
KEY_TYPE_NORMAL = ApiKeyType.NORMAL
|
||||||
|
|||||||
@@ -5,13 +5,13 @@ from urllib.parse import unquote
|
|||||||
from flask import current_app, request
|
from flask import current_app, request
|
||||||
|
|
||||||
from app import redis_client
|
from app import redis_client
|
||||||
|
from app.enums import InvitedUserStatus
|
||||||
from app.notify_client import NotifyAdminAPIClient, _attach_current_user, cache
|
from app.notify_client import NotifyAdminAPIClient, _attach_current_user, cache
|
||||||
from app.utils.user_permissions import (
|
from app.utils.user_permissions import (
|
||||||
all_ui_permissions,
|
all_ui_permissions,
|
||||||
translate_permissions_from_ui_to_db,
|
translate_permissions_from_ui_to_db,
|
||||||
)
|
)
|
||||||
from notifications_utils.url_safe_token import generate_token
|
from notifications_utils.url_safe_token import generate_token
|
||||||
from app.enums import InvitedUserStatus
|
|
||||||
|
|
||||||
|
|
||||||
class InviteApiClient(NotifyAdminAPIClient):
|
class InviteApiClient(NotifyAdminAPIClient):
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
import datetime
|
import datetime
|
||||||
from zoneinfo import ZoneInfo
|
from zoneinfo import ZoneInfo
|
||||||
|
|
||||||
|
from app.enums import JobStatus
|
||||||
from app.extensions import redis_client
|
from app.extensions import redis_client
|
||||||
from app.notify_client import NotifyAdminAPIClient, _attach_current_user, cache
|
from app.notify_client import NotifyAdminAPIClient, _attach_current_user, cache
|
||||||
from app.utils.csv import get_user_preferred_timezone
|
from app.utils.csv import get_user_preferred_timezone
|
||||||
from app.enums import JobStatus
|
|
||||||
|
|
||||||
|
|
||||||
class JobApiClient(NotifyAdminAPIClient):
|
class JobApiClient(NotifyAdminAPIClient):
|
||||||
@@ -58,7 +58,7 @@ class JobApiClient(NotifyAdminAPIClient):
|
|||||||
job["original_file_name"],
|
job["original_file_name"],
|
||||||
)
|
)
|
||||||
for job in self.get_jobs(service_id, limit_days=0)["data"]
|
for job in self.get_jobs(service_id, limit_days=0)["data"]
|
||||||
if job["job_status"] != JobStatus.CANCELLED.value
|
if job["job_status"] != JobStatus.CANCELLED
|
||||||
)
|
)
|
||||||
|
|
||||||
def get_page_of_jobs(self, service_id, *, page, statuses=None, limit_days=None):
|
def get_page_of_jobs(self, service_id, *, page, statuses=None, limit_days=None):
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
from app.notify_client import NotifyAdminAPIClient, _attach_current_user
|
|
||||||
from app.enums import InvitedOrgUserStatus
|
from app.enums import InvitedOrgUserStatus
|
||||||
|
from app.notify_client import NotifyAdminAPIClient, _attach_current_user
|
||||||
|
|
||||||
|
|
||||||
class OrgInviteApiClient(NotifyAdminAPIClient):
|
class OrgInviteApiClient(NotifyAdminAPIClient):
|
||||||
|
|||||||
@@ -7,16 +7,21 @@ from ordered_set import OrderedSet
|
|||||||
from werkzeug.datastructures import MultiDict
|
from werkzeug.datastructures import MultiDict
|
||||||
from werkzeug.routing import RequestRedirect
|
from werkzeug.routing import RequestRedirect
|
||||||
|
|
||||||
|
from app.enums import NotificationStatus
|
||||||
from notifications_utils.field import Field
|
from notifications_utils.field import Field
|
||||||
|
|
||||||
SENDING_STATUSES = ["created", "pending", "sending"]
|
SENDING_STATUSES = [
|
||||||
DELIVERED_STATUSES = ["delivered", "sent"]
|
NotificationStatus.CREATED,
|
||||||
|
NotificationStatus.PENDING,
|
||||||
|
NotificationStatus.SENDING,
|
||||||
|
]
|
||||||
|
DELIVERED_STATUSES = [NotificationStatus.DELIVERED, NotificationStatus.SENT]
|
||||||
FAILURE_STATUSES = [
|
FAILURE_STATUSES = [
|
||||||
"failed",
|
NotificationStatus.FAILED,
|
||||||
"temporary-failure",
|
NotificationStatus.TEMPORARY_FAILURE,
|
||||||
"permanent-failure",
|
NotificationStatus.PERMANENT_FAILURE,
|
||||||
"technical-failure",
|
NotificationStatus.TECHNICAL_FAILURE,
|
||||||
"validation-failed",
|
NotificationStatus.VALIDATION_FAILED,
|
||||||
]
|
]
|
||||||
REQUESTED_STATUSES = SENDING_STATUSES + DELIVERED_STATUSES + FAILURE_STATUSES
|
REQUESTED_STATUSES = SENDING_STATUSES + DELIVERED_STATUSES + FAILURE_STATUSES
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user