From 2b55e40d5793cdda88bd5991a08de2b5b10d7c5a Mon Sep 17 00:00:00 2001 From: David Kennedy Date: Wed, 18 Oct 2023 11:04:05 -0400 Subject: [PATCH] refactored _get_contacts to return default dict when no contacts exist rather then empty dict --- src/registrar/models/domain.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/registrar/models/domain.py b/src/registrar/models/domain.py index e444f2a61..a212480e7 100644 --- a/src/registrar/models/domain.py +++ b/src/registrar/models/domain.py @@ -1743,7 +1743,14 @@ class Domain(TimeStampedModel, DomainHelper): return dnssec_data 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: cleaned_contacts = self._fetch_contacts(contacts) return cleaned_contacts