mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-07-21 10:16:13 +02:00
Revert changes
This commit is contained in:
parent
5a28ec9bea
commit
237b120d1f
4 changed files with 47 additions and 12 deletions
|
@ -15,7 +15,7 @@ from epplibwrapper import (
|
|||
RegistryError,
|
||||
ErrorCode,
|
||||
)
|
||||
from registrar.models.utility.contact_error import ContactError
|
||||
from registrar.models.utility.contact_error import ContactError, ContactErrorCodes
|
||||
|
||||
from .utility.domain_field import DomainField
|
||||
from .utility.domain_helper import DomainHelper
|
||||
|
@ -698,10 +698,10 @@ class Domain(TimeStampedModel, DomainHelper):
|
|||
return None
|
||||
|
||||
if contact_type is None:
|
||||
raise ContactError("contact_type is None")
|
||||
raise ContactError(code=ContactErrorCodes.CONTACT_TYPE_NONE)
|
||||
|
||||
if contact_id is None:
|
||||
raise ContactError("contact_id is None")
|
||||
raise ContactError(code=ContactErrorCodes.CONTACT_ID_NONE)
|
||||
|
||||
# Since contact_id is registry_id,
|
||||
# check that its the right length
|
||||
|
@ -710,14 +710,10 @@ class Domain(TimeStampedModel, DomainHelper):
|
|||
contact_id_length > PublicContact.get_max_id_length()
|
||||
or contact_id_length < 1
|
||||
):
|
||||
raise ContactError(
|
||||
"contact_id is of invalid length. "
|
||||
"Cannot exceed 16 characters, "
|
||||
f"got {contact_id} with a length of {contact_id_length}"
|
||||
)
|
||||
raise ContactError(code=ContactErrorCodes.CONTACT_ID_INVALID_LENGTH)
|
||||
|
||||
if not isinstance(contact, eppInfo.InfoContactResultData):
|
||||
raise ContactError("Contact must be of type InfoContactResultData")
|
||||
raise ContactError(code=ContactErrorCodes.CONTACT_INVALID_TYPE)
|
||||
|
||||
auth_info = contact.auth_info
|
||||
postal_info = contact.postal_info
|
||||
|
|
|
@ -20,4 +20,32 @@ class ContactErrorCodes(IntEnum):
|
|||
|
||||
|
||||
class ContactError(Exception):
|
||||
...
|
||||
"""
|
||||
Overview of contact error codes:
|
||||
- 2000 CONTACT_TYPE_NONE
|
||||
- 2001 CONTACT_ID_NONE
|
||||
- 2002 CONTACT_ID_INVALID_LENGTH
|
||||
- 2003 CONTACT_INVALID_TYPE
|
||||
- 2004 CONTACT_NOT_FOUND
|
||||
"""
|
||||
|
||||
# For linter
|
||||
_contact_id_error = "contact_id has an invalid length. Cannot exceed 16 characters."
|
||||
_contact_invalid_error = "Contact must be of type InfoContactResultData"
|
||||
_contact_not_found_error = "No contact was found in cache or the registry"
|
||||
_error_mapping = {
|
||||
ContactErrorCodes.CONTACT_TYPE_NONE: "contact_type is None",
|
||||
ContactErrorCodes.CONTACT_ID_NONE: "contact_id is None",
|
||||
ContactErrorCodes.CONTACT_ID_INVALID_LENGTH: _contact_id_error,
|
||||
ContactErrorCodes.CONTACT_INVALID_TYPE: _contact_invalid_error,
|
||||
ContactErrorCodes.CONTACT_NOT_FOUND: _contact_not_found_error
|
||||
}
|
||||
|
||||
def __init__(self, *args, code=None, **kwargs):
|
||||
super().__init__(*args, **kwargs)
|
||||
self.code = code
|
||||
if self.code in self._error_mapping:
|
||||
self.message = self._error_mapping.get(self.code)
|
||||
|
||||
def __str__(self):
|
||||
return f"{self.message}"
|
||||
|
|
|
@ -46,8 +46,11 @@
|
|||
{% include "includes/summary_item.html" with title='Your contact information' value=request.user.contact contact='true' edit_link=url %}
|
||||
|
||||
{% url 'domain-security-email' pk=domain.id as url %}
|
||||
{% include "includes/summary_item.html" with title='Security email' value=domain.security_email edit_link=url %}
|
||||
|
||||
{% if security_email is not None and security_email != "dotgov@cisa.dhs.gov"%}
|
||||
{% include "includes/summary_item.html" with title='Security email' value=security_email edit_link=url %}
|
||||
{% else %}
|
||||
{% include "includes/summary_item.html" with title='Security email' value='None provided' edit_link=url %}
|
||||
{% endif %}
|
||||
{% url 'domain-users' pk=domain.id as url %}
|
||||
{% include "includes/summary_item.html" with title='User management' users='true' list=True value=domain.permissions.all edit_link=url %}
|
||||
|
||||
|
|
|
@ -42,6 +42,14 @@ class DomainView(DomainPermissionView):
|
|||
|
||||
template_name = "domain_detail.html"
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
context = super().get_context_data(**kwargs)
|
||||
security_email = self.get_object().get_security_email()
|
||||
if security_email is None or security_email == "dotgov@cisa.dhs.gov":
|
||||
context["security_email"] = None
|
||||
return context
|
||||
context["security_email"] = security_email
|
||||
return context
|
||||
|
||||
class DomainOrgNameAddressView(DomainPermissionView, FormMixin):
|
||||
"""Organization name and mailing address view"""
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue