Update name

This commit is contained in:
zandercymatics 2024-02-28 10:00:13 -07:00
parent 820d6f3f58
commit 2ba62bf174
No known key found for this signature in database
GPG key ID: FF4636ABEC9682B7
3 changed files with 8 additions and 12 deletions

View file

@ -16,7 +16,7 @@ from dateutil.relativedelta import relativedelta # type: ignore
from epplibwrapper.errors import ErrorCode, RegistryError from epplibwrapper.errors import ErrorCode, RegistryError
from registrar.models import Contact, Domain, DomainApplication, DraftDomain, User, Website from registrar.models import Contact, Domain, DomainApplication, DraftDomain, User, Website
from registrar.utility import csv_export from registrar.utility import csv_export
from registrar.utility.errors import ApplicationStatusError, FSMErrorCodes from registrar.utility.errors import FSMApplicationError, FSMErrorCodes
from registrar.views.utility.mixins import OrderableFieldsMixin from registrar.views.utility.mixins import OrderableFieldsMixin
from django.contrib.admin.views.main import ORDER_VAR from django.contrib.admin.views.main import ORDER_VAR
from registrar.widgets import NoAutocompleteFilteredSelectMultiple from registrar.widgets import NoAutocompleteFilteredSelectMultiple
@ -167,9 +167,9 @@ class DomainApplicationAdminForm(forms.ModelForm):
error_message = None error_message = None
if investigator is None: if investigator is None:
# Lets grab the error message from a common location # Lets grab the error message from a common location
error_message = ApplicationStatusError.get_error_message(FSMErrorCodes.NO_INVESTIGATOR) error_message = FSMApplicationError.get_error_message(FSMErrorCodes.NO_INVESTIGATOR)
elif not investigator.is_staff: elif not investigator.is_staff:
error_message = ApplicationStatusError.get_error_message(FSMErrorCodes.INVESTIGATOR_NOT_STAFF) error_message = FSMApplicationError.get_error_message(FSMErrorCodes.INVESTIGATOR_NOT_STAFF)
else: else:
is_valid = True is_valid = True
@ -1225,11 +1225,11 @@ class DomainApplicationAdmin(ListHeaderAdmin):
obj.status = original_obj.status obj.status = original_obj.status
# Try to perform the status change. # Try to perform the status change.
# Catch ApplicationStatusError's and return the message, # Catch FSMApplicationError's and return the message,
# as these are typically user errors. # as these are typically user errors.
try: try:
selected_method() selected_method()
except ApplicationStatusError as err: except FSMApplicationError as err:
logger.warning(f"An error encountered when trying to change status: {err}") logger.warning(f"An error encountered when trying to change status: {err}")
error_message = err.message error_message = err.message

View file

@ -9,7 +9,7 @@ from django.db import models
from django_fsm import FSMField, transition # type: ignore from django_fsm import FSMField, transition # type: ignore
from django.utils import timezone from django.utils import timezone
from registrar.models.domain import Domain from registrar.models.domain import Domain
from registrar.utility.errors import ApplicationStatusError, FSMErrorCodes from registrar.utility.errors import FSMApplicationError, FSMErrorCodes
from .utility.time_stamped_model import TimeStampedModel from .utility.time_stamped_model import TimeStampedModel
from ..utility.email import send_templated_email, EmailSendingError from ..utility.email import send_templated_email, EmailSendingError
@ -791,7 +791,7 @@ class DomainApplication(TimeStampedModel):
# == Check that the application is valid == # # == Check that the application is valid == #
if Domain.objects.filter(name=self.requested_domain.name).exists(): if Domain.objects.filter(name=self.requested_domain.name).exists():
raise ApplicationStatusError(code=FSMErrorCodes.APPROVE_DOMAIN_IN_USE) raise FSMApplicationError(code=FSMErrorCodes.APPROVE_DOMAIN_IN_USE)
# == Create the domain and related components == # # == Create the domain and related components == #
created_domain = Domain.objects.create(name=self.requested_domain.name) created_domain = Domain.objects.create(name=self.requested_domain.name)

View file

@ -71,8 +71,6 @@ class GenericError(Exception):
return self._error_mapping.get(code) return self._error_mapping.get(code)
# (Q for reviewers) What should this be called?
# Not a fan of this name.
class FSMErrorCodes(IntEnum): class FSMErrorCodes(IntEnum):
"""Used when doing FSM transitions. """Used when doing FSM transitions.
Overview of generic error codes: Overview of generic error codes:
@ -88,9 +86,7 @@ class FSMErrorCodes(IntEnum):
INVESTIGATOR_NOT_SUBMITTER = 4 INVESTIGATOR_NOT_SUBMITTER = 4
# (Q for reviewers) What should this be called? class FSMApplicationError(Exception):
# Not a fan of this name.
class ApplicationStatusError(Exception):
""" """
Used to raise exceptions when doing FSM Transitions. Used to raise exceptions when doing FSM Transitions.
Uses `FSMErrorCodes` as an enum. Uses `FSMErrorCodes` as an enum.