diff --git a/src/registrar/utility/csv_export.py b/src/registrar/utility/csv_export.py index 334742d17..dbd1bf5cb 100644 --- a/src/registrar/utility/csv_export.py +++ b/src/registrar/utility/csv_export.py @@ -18,6 +18,7 @@ from django.contrib.postgres.aggregates import StringAgg from registrar.models.utility.generic_helper import convert_queryset_to_dict from registrar.templatetags.custom_filters import get_region from registrar.utility.constants import BranchChoices +from registrar.utility.enums import DefaultEmail logger = logging.getLogger(__name__) @@ -371,6 +372,15 @@ class DomainExport(BaseExport): if domain_federal_type and domain_org_type == DomainRequest.OrgChoicesElectionOffice.FEDERAL: domain_type = f"{human_readable_domain_org_type} - {human_readable_domain_federal_type}" + security_contact_email = model.get("security_contact_email") + invalid_emails = {DefaultEmail.LEGACY_DEFAULT, DefaultEmail.PUBLIC_CONTACT_DEFAULT} + if ( + not security_contact_email + or not isinstance(security_contact_email, str) + or security_contact_email.lower() in invalid_emails + ): + security_contact_email = "(blank)" + # create a dictionary of fields which can be included in output. # "extra_fields" are precomputed fields (generated in the DB or parsed). FIELDS = {