Don't display default email

This commit is contained in:
zandercymatics 2023-09-22 10:09:32 -06:00
parent df1d61b965
commit 84f2b5d5b2
No known key found for this signature in database
GPG key ID: FF4636ABEC9682B7
3 changed files with 14 additions and 14 deletions

View file

@ -514,9 +514,7 @@ class Domain(TimeStampedModel, DomainHelper):
.filter(domain=self, contact_type=contact.contact_type) .filter(domain=self, contact_type=contact.contact_type)
.get() .get()
) )
logger.info(
f"_set_singleton_contact() -> existing contact is... {existing_contact.__dict__}"
)
if isRegistrant: if isRegistrant:
# send update domain only for registant contacts # send update domain only for registant contacts
existing_contact.delete() existing_contact.delete()
@ -695,7 +693,8 @@ class Domain(TimeStampedModel, DomainHelper):
if len(contact_id) > 16 or len(contact_id) < 1: if len(contact_id) > 16 or len(contact_id) < 1:
raise ValueError( raise ValueError(
"contact_id is of invalid length. " "contact_id is of invalid length. "
f"Cannot exceed 16 characters, got {contact_id} with a length of {len(contact_id)}" "Cannot exceed 16 characters, "
f"got {contact_id} with a length of {len(contact_id)}"
) )
logger.debug(f"map_epp_contact_to_public_contact contact -> {contact}") logger.debug(f"map_epp_contact_to_public_contact contact -> {contact}")
@ -755,12 +754,12 @@ class Domain(TimeStampedModel, DomainHelper):
return registry.send(req, cleaned=True).res_data[0] return registry.send(req, cleaned=True).res_data[0]
except RegistryError as error: except RegistryError as error:
logger.error( logger.error(
"Registry threw error for contact id %s contact type is %s, error code is\n %s full error is %s", "Registry threw error for contact id %s contact type is %s, error code is\n %s full error is %s", # noqa
contact.registry_id, contact.registry_id,
contact.contact_type, contact.contact_type,
error.code, error.code,
error, error,
) # noqa )
raise error raise error
def get_contact_default( def get_contact_default(
@ -814,7 +813,10 @@ class Domain(TimeStampedModel, DomainHelper):
logger.error(error) logger.error(error)
return None return None
else: else:
# Grab from cache after its been created # Grab from cache
if(self._cache and desired_property in self._cache):
return self.grab_contact_in_keys(self._cache[desired_property], contact_type_choice)
cached_contact = self.grab_contact_in_keys(contacts, contact_type_choice) cached_contact = self.grab_contact_in_keys(contacts, contact_type_choice)
if cached_contact is None: if cached_contact is None:
raise ValueError("No contact was found in cache or the registry") raise ValueError("No contact was found in cache or the registry")
@ -1188,7 +1190,8 @@ class Domain(TimeStampedModel, DomainHelper):
# if not, that's a problem # if not, that's a problem
# TODO- discuss-should we check if contact is in public contacts # TODO- discuss-should we check if contact is in public contacts
# and add it if not- this is really to keep in mind for the transition # and add it if not-
# this is really to keep in mind for the transition
req = commands.InfoContact(id=domainContact.contact) req = commands.InfoContact(id=domainContact.contact)
data = registry.send(req, cleaned=True).res_data[0] data = registry.send(req, cleaned=True).res_data[0]
@ -1256,9 +1259,6 @@ class Domain(TimeStampedModel, DomainHelper):
def _get_property(self, property): def _get_property(self, property):
"""Get some piece of info about a domain.""" """Get some piece of info about a domain."""
logger.info(
f"_get_property() -> prop is... {property} prop in cache... {property not in self._cache} cache is {self._cache}"
)
if property not in self._cache: if property not in self._cache:
self._fetch_cache( self._fetch_cache(
fetch_hosts=(property == "hosts"), fetch_hosts=(property == "hosts"),

View file

@ -275,9 +275,6 @@ class TestDomainStatuses(MockEppLib):
_ = domain.statuses _ = domain.statuses
status_list = [status.state for status in self.mockDataInfoDomain.statuses] status_list = [status.state for status in self.mockDataInfoDomain.statuses]
self.assertEquals(domain._cache["statuses"], status_list) self.assertEquals(domain._cache["statuses"], status_list)
expectedCreateContact = self._convertPublicContactToEpp(
domain.security_contact, True, createContact=True
)
# Called in _fetch_cache # Called in _fetch_cache
self.mockedSendFunction.assert_has_calls( self.mockedSendFunction.assert_has_calls(
[ [

View file

@ -250,6 +250,9 @@ class DomainSecurityEmailView(DomainPermissionView, FormMixin):
"""The initial value for the form.""" """The initial value for the form."""
domain = self.get_object() domain = self.get_object()
initial = super().get_initial() initial = super().get_initial()
if(domain.security_contact.email == "dotgov@cisa.dhs.gov"):
initial["security_email"] = None
return initial
initial["security_email"] = domain.security_contact.email initial["security_email"] = domain.security_contact.email
return initial return initial