Signed-off-by: CocoByte <nicolle.leclair@gmail.com>
This commit is contained in:
CocoByte 2023-10-06 03:23:16 -06:00
parent 604821ad07
commit bede4c8607
No known key found for this signature in database
GPG key ID: BBFAA2526384C97F

View file

@ -29,10 +29,9 @@ class termColors:
UNDERLINE = "\033[4m" UNDERLINE = "\033[4m"
BackgroundLightYellow = "\033[103m" BackgroundLightYellow = "\033[103m"
def print_debug_mode_statements(
def print_debug_mode_statements(self, self, debug_on: bool, debug_max_entries_to_parse: int
debug_on: bool, ):
debug_max_entries_to_parse: int):
"""Prints additional terminal statements to indicate if --debug """Prints additional terminal statements to indicate if --debug
or --limitParse are in use""" or --limitParse are in use"""
if debug_on: if debug_on:
@ -65,9 +64,9 @@ class Command(BaseCommand):
parser.add_argument("--debug", action=argparse.BooleanOptionalAction) parser.add_argument("--debug", action=argparse.BooleanOptionalAction)
parser.add_argument( parser.add_argument(
"--limitParse", "--limitParse",
default=0, default=0,
help="Sets max number of entries to load, set to 0 to load all entries" help="Sets max number of entries to load, set to 0 to load all entries",
) )
def handle( # noqa: C901 def handle( # noqa: C901
@ -75,7 +74,7 @@ class Command(BaseCommand):
**options, **options,
): ):
"""Parse entries in TransitionDomain table """Parse entries in TransitionDomain table
and create (or update) corresponding entries in the and create (or update) corresponding entries in the
Domain and DomainInvitation tables.""" Domain and DomainInvitation tables."""
# grab command line arguments and store locally... # grab command line arguments and store locally...
@ -117,7 +116,7 @@ class Command(BaseCommand):
logger.info( logger.info(
f"""{termColors.YELLOW} f"""{termColors.YELLOW}
Processing Transition Domain: {transition_domain_name}, {transition_domain_status} Processing Transition Domain: {transition_domain_name}, {transition_domain_status}
{termColors.ENDC}""" # noqa {termColors.ENDC}""" # noqa
) )
# for existing entry, update the status to # for existing entry, update the status to
@ -130,7 +129,7 @@ class Command(BaseCommand):
logger.info( logger.info(
f"""{termColors.YELLOW} f"""{termColors.YELLOW}
> Found existing domain entry for: {transition_domain_name}, {current_state} > Found existing domain entry for: {transition_domain_name}, {current_state}
{termColors.ENDC}""" # noqa {termColors.ENDC}""" # noqa
) )
if transition_domain_status != current_state: if transition_domain_status != current_state:
if ( if (
@ -147,21 +146,21 @@ class Command(BaseCommand):
logger.info( logger.info(
f"""{termColors.YELLOW} f"""{termColors.YELLOW}
>> Updated {transition_domain_name} state from >> Updated {transition_domain_name} state from
'{current_state}' to '{existingEntry.state}{termColors.ENDC}' '{current_state}' to '{existingEntry.state}'
(no domain invitation entry added)""" (no domain invitation entry added)
{termColors.ENDC}"""
) )
except Domain.DoesNotExist: except Domain.DoesNotExist:
# no matching entry, make one # no matching entry, make one
newEntry = Domain( newEntry = Domain(
name=transition_domain_name, name=transition_domain_name, state=transition_domain_status
state=transition_domain_status
) )
domains_to_create.append(newEntry) domains_to_create.append(newEntry)
domain_invitations_to_create.append( domain_invitations_to_create.append(
DomainInvitation( DomainInvitation(
email=transition_domain_email.lower(), email=transition_domain_email.lower(),
domain=transition_domain_name domain=transition_domain_name,
) )
) )
@ -247,5 +246,3 @@ class Command(BaseCommand):
{termColors.ENDC} {termColors.ENDC}
""" """
) )