mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-08-19 07:54:16 +02:00
Add default text
This commit is contained in:
parent
9546aedd59
commit
540a604055
4 changed files with 16 additions and 8 deletions
|
@ -688,14 +688,10 @@ class Domain(TimeStampedModel, DomainHelper):
|
||||||
contact_id_length > PublicContact.get_max_id_length()
|
contact_id_length > PublicContact.get_max_id_length()
|
||||||
or contact_id_length < 1
|
or contact_id_length < 1
|
||||||
):
|
):
|
||||||
raise ContactError(
|
raise ContactError(code=ContactErrorCodes.CONTACT_ID_INVALID_LENGTH)
|
||||||
"contact_id is of invalid length. "
|
|
||||||
"Cannot exceed 16 characters, "
|
|
||||||
f"got {contact_id} with a length of {contact_id_length}"
|
|
||||||
)
|
|
||||||
|
|
||||||
if not isinstance(contact, eppInfo.InfoContactResultData):
|
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
|
auth_info = contact.auth_info
|
||||||
postal_info = contact.postal_info
|
postal_info = contact.postal_info
|
||||||
|
@ -805,7 +801,7 @@ class Domain(TimeStampedModel, DomainHelper):
|
||||||
cached_contact = self.get_contact_in_keys(contacts, contact_type_choice)
|
cached_contact = self.get_contact_in_keys(contacts, contact_type_choice)
|
||||||
if cached_contact is None:
|
if cached_contact is None:
|
||||||
# TODO - #1103
|
# TODO - #1103
|
||||||
raise ContactError("No contact was found in cache or the registry")
|
raise ContactError(code=ContactErrorCodes.CONTACT_NOT_FOUND)
|
||||||
|
|
||||||
return cached_contact
|
return cached_contact
|
||||||
|
|
||||||
|
|
|
@ -17,6 +17,7 @@ class ContactErrorCodes(IntEnum):
|
||||||
CONTACT_ID_NONE = 2001
|
CONTACT_ID_NONE = 2001
|
||||||
CONTACT_ID_INVALID_LENGTH = 2002
|
CONTACT_ID_INVALID_LENGTH = 2002
|
||||||
CONTACT_INVALID_TYPE = 2003
|
CONTACT_INVALID_TYPE = 2003
|
||||||
|
CONTACT_NOT_FOUND = 2004
|
||||||
|
|
||||||
|
|
||||||
class ContactError(Exception):
|
class ContactError(Exception):
|
||||||
|
@ -26,16 +27,19 @@ class ContactError(Exception):
|
||||||
- 2001 CONTACT_ID_NONE
|
- 2001 CONTACT_ID_NONE
|
||||||
- 2002 CONTACT_ID_INVALID_LENGTH
|
- 2002 CONTACT_ID_INVALID_LENGTH
|
||||||
- 2003 CONTACT_INVALID_TYPE
|
- 2003 CONTACT_INVALID_TYPE
|
||||||
|
- 2004 CONTACT_NOT_FOUND
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# For linter
|
# For linter
|
||||||
_contact_id_error = "contact_id has an invalid length. Cannot exceed 16 characters."
|
_contact_id_error = "contact_id has an invalid length. Cannot exceed 16 characters."
|
||||||
_contact_invalid_error = "Contact must be of type InfoContactResultData"
|
_contact_invalid_error = "Contact must be of type InfoContactResultData"
|
||||||
|
_contact_not_found_error = "No contact was found in cache or the registry"
|
||||||
_error_mapping = {
|
_error_mapping = {
|
||||||
ContactErrorCodes.CONTACT_TYPE_NONE: "contact_type is None",
|
ContactErrorCodes.CONTACT_TYPE_NONE: "contact_type is None",
|
||||||
ContactErrorCodes.CONTACT_ID_NONE: "contact_id is None",
|
ContactErrorCodes.CONTACT_ID_NONE: "contact_id is None",
|
||||||
ContactErrorCodes.CONTACT_ID_INVALID_LENGTH: _contact_id_error,
|
ContactErrorCodes.CONTACT_ID_INVALID_LENGTH: _contact_id_error,
|
||||||
ContactErrorCodes.CONTACT_INVALID_TYPE: _contact_invalid_error,
|
ContactErrorCodes.CONTACT_INVALID_TYPE: _contact_invalid_error,
|
||||||
|
ContactErrorCodes.CONTACT_NOT_FOUND: _contact_not_found_error
|
||||||
}
|
}
|
||||||
|
|
||||||
def __init__(self, *args, code=None, **kwargs):
|
def __init__(self, *args, code=None, **kwargs):
|
||||||
|
|
|
@ -49,7 +49,7 @@
|
||||||
{% if security_email is not None and security_email != "dotgov@cisa.dhs.gov"%}
|
{% 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 %}
|
{% include "includes/summary_item.html" with title='Security email' value=security_email edit_link=url %}
|
||||||
{% else %}
|
{% else %}
|
||||||
{% include "includes/summary_item.html" with title='Security email' value=None edit_link=url %}
|
{% include "includes/summary_item.html" with title='Security email' value='None provided' edit_link=url %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% url 'domain-users' pk=domain.id as url %}
|
{% 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 %}
|
{% 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"
|
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):
|
class DomainOrgNameAddressView(DomainPermissionView, FormMixin):
|
||||||
"""Organization name and mailing address view"""
|
"""Organization name and mailing address view"""
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue