refactored _get_contacts to return default dict when no contacts exist rather then empty dict

This commit is contained in:
David Kennedy 2023-10-18 11:04:05 -04:00
parent a587920c45
commit 2b55e40d57
No known key found for this signature in database
GPG key ID: 6528A5386E66B96B

View file

@ -1743,7 +1743,14 @@ class Domain(TimeStampedModel, DomainHelper):
return dnssec_data return dnssec_data
def _get_contacts(self, contacts): def _get_contacts(self, contacts):
cleaned_contacts = {} choices = PublicContact.ContactTypeChoices
# We expect that all these fields get populated,
# so we can create these early, rather than waiting.
cleaned_contacts = {
choices.ADMINISTRATIVE: None,
choices.SECURITY: None,
choices.TECHNICAL: None,
}
if contacts and isinstance(contacts, list) and len(contacts) > 0: if contacts and isinstance(contacts, list) and len(contacts) > 0:
cleaned_contacts = self._fetch_contacts(contacts) cleaned_contacts = self._fetch_contacts(contacts)
return cleaned_contacts return cleaned_contacts