Warning logs

This commit is contained in:
zandercymatics 2024-07-19 10:07:15 -06:00
parent 0aa3b8f899
commit 0aa1309843
No known key found for this signature in database
GPG key ID: FF4636ABEC9682B7
3 changed files with 19 additions and 17 deletions

View file

@ -170,18 +170,11 @@ class CreateOrUpdateOrganizationTypeHelper:
# There is no avenue for this to occur in the UI, # There is no avenue for this to occur in the UI,
# as such - this can only occur if the object is initialized in this way. # as such - this can only occur if the object is initialized in this way.
# Or if there are pre-existing data. # Or if there are pre-existing data.
logger.debug(
"create_or_update_organization_type() -> is_election_board "
f"cannot exist for {generic_org_type}. Setting to None."
)
self.instance.is_election_board = None self.instance.is_election_board = None
self.instance.organization_type = generic_org_type self.instance.organization_type = generic_org_type
else: else:
# This can only happen with manual data tinkering, which causes these to be out of sync. # This can only happen with manual data tinkering, which causes these to be out of sync.
if self.instance.is_election_board is None: if self.instance.is_election_board is None:
logger.warning(
"create_or_update_organization_type() -> is_election_board is out of sync. Updating value."
)
self.instance.is_election_board = False self.instance.is_election_board = False
if self.instance.is_election_board: if self.instance.is_election_board:
@ -218,10 +211,6 @@ class CreateOrUpdateOrganizationTypeHelper:
# There is no avenue for this to occur in the UI, # There is no avenue for this to occur in the UI,
# as such - this can only occur if the object is initialized in this way. # as such - this can only occur if the object is initialized in this way.
# Or if there are pre-existing data. # Or if there are pre-existing data.
logger.warning(
"create_or_update_organization_type() -> is_election_board "
f"cannot exist for {current_org_type}. Setting to None."
)
self.instance.is_election_board = None self.instance.is_election_board = None
else: else:
# if self.instance.organization_type is set to None, then this means # if self.instance.organization_type is set to None, then this means

View file

@ -1,7 +1,16 @@
import io import io
from django.test import Client, RequestFactory, TestCase from django.test import Client, RequestFactory, TestCase
from io import StringIO from io import StringIO
from registrar.models import DomainRequest, Domain, DomainInformation, UserDomainRole, User, PublicContact, DomainInvitation, FederalAgency from registrar.models import (
DomainRequest,
Domain,
DomainInformation,
UserDomainRole,
User,
PublicContact,
DomainInvitation,
FederalAgency,
)
from registrar.utility.csv_export import ( from registrar.utility.csv_export import (
DomainDataFull, DomainDataFull,
DomainDataType, DomainDataType,
@ -276,7 +285,7 @@ class ExportDataTestUserFacing(TestCase):
"State,SO,SO email,Security contact email,Domain managers,Invited domain managers\n" "State,SO,SO email,Security contact email,Domain managers,Invited domain managers\n"
"interfere.gov,Ready,(blank),(blank),Federal - Executive,,," "interfere.gov,Ready,(blank),(blank),Federal - Executive,,,"
", ,,(blank),staff@example.com,\n" ", ,,(blank),staff@example.com,\n"
"somedomain123.gov,Dns needed,(blank),(blank),Interstate,,,,, ,," "somedomain1234.gov,Dns needed,(blank),(blank),Interstate,,,,, ,,"
"(blank),staff@example.com,\n" "(blank),staff@example.com,\n"
) )
@ -293,7 +302,6 @@ class ExportDataTest(MockDb, MockEppLib):
def setUp(self): def setUp(self):
super().setUp() super().setUp()
self.factory = RequestFactory()
def tearDown(self): def tearDown(self):
super().tearDown() super().tearDown()

View file

@ -559,6 +559,11 @@ class DomainDataTypeUser(DomainDataType):
The DomainDataType report, but sliced on the current request user The DomainDataType report, but sliced on the current request user
""" """
@classmethod
def export_data_to_csv(cls, csv_file, request=None):
logger.warning("in export_data_to_csv")
super().export_data_to_csv(csv_file, request=request)
@classmethod @classmethod
def get_filter_conditions(cls, request=None): def get_filter_conditions(cls, request=None):
""" """
@ -566,12 +571,12 @@ class DomainDataTypeUser(DomainDataType):
""" """
if request is None or not hasattr(request, "user") or not request.user: if request is None or not hasattr(request, "user") or not request.user:
# Return nothing # Return nothing
logger.info(f"returning nothing: {request}") logger.warning(f"returning nothing: {request}")
return Q(id__in=[]) return Q(id__in=[])
user_domain_roles = UserDomainRole.objects.filter(user=request.user) user_domain_roles = UserDomainRole.objects.filter(user=request.user)
domain_ids = user_domain_roles.values_list("domain_id", flat=True) domain_ids = user_domain_roles.values_list("domain_id", flat=True)
logger.info(f"roles: {user_domain_roles} ids: {domain_ids}") logger.warning(f"roles: {user_domain_roles} ids: {domain_ids}")
return Q(id__in=domain_ids) return Q(id__in=domain_ids)