formatting for linting

This commit is contained in:
David Kennedy 2023-10-24 15:07:12 -04:00
parent 182d1a61c0
commit 497e81f6fa
No known key found for this signature in database
GPG key ID: 6528A5386E66B96B
3 changed files with 12 additions and 30 deletions

View file

@ -78,7 +78,7 @@ class DomainNameserverForm(forms.Form):
NameserverError( NameserverError(
code=nsErrorCodes.GLUE_RECORD_NOT_ALLOWED, code=nsErrorCodes.GLUE_RECORD_NOT_ALLOWED,
nameserver=domain, nameserver=domain,
ip=ip_list ip=ip_list,
), ),
) )
elif e.code == nsErrorCodes.MISSING_IP: elif e.code == nsErrorCodes.MISSING_IP:
@ -88,7 +88,7 @@ class DomainNameserverForm(forms.Form):
code=nsErrorCodes.MISSING_IP, code=nsErrorCodes.MISSING_IP,
nameserver=domain, nameserver=domain,
ip=ip_list, ip=ip_list,
) ),
) )
else: else:
self.add_error("ip", str(e)) self.add_error("ip", str(e))

View file

@ -39,10 +39,10 @@ class GenericError(Exception):
""" """
_error_mapping = { _error_mapping = {
GenericErrorCodes.CANNOT_CONTACT_REGISTRY: "Update failed. Cannot contact the registry.", GenericErrorCodes.CANNOT_CONTACT_REGISTRY: (
GenericErrorCodes.GENERIC_ERROR: ( "Update failed. Cannot contact the registry."
"Value entered was wrong."
), ),
GenericErrorCodes.GENERIC_ERROR: ("Value entered was wrong."),
} }
def __init__(self, *args, code=None, **kwargs): def __init__(self, *args, code=None, **kwargs):

View file

@ -317,10 +317,7 @@ class DomainNameserversView(DomainFormBaseView):
# NamserverErrors *should* be caught in form; if reached here, # NamserverErrors *should* be caught in form; if reached here,
# there was an uncaught error in submission (through EPP) # there was an uncaught error in submission (through EPP)
messages.error( messages.error(
self.request, self.request, NameserverError(code=nsErrorCodes.UNABLE_TO_UPDATE_DOMAIN)
NameserverError(
code=nsErrorCodes.UNABLE_TO_UPDATE_DOMAIN
)
) )
logger.error(f"Nameservers error: {Err}") logger.error(f"Nameservers error: {Err}")
# TODO: registry is not throwing an error when no connection # TODO: registry is not throwing an error when no connection
@ -328,17 +325,12 @@ class DomainNameserversView(DomainFormBaseView):
if Err.is_connection_error(): if Err.is_connection_error():
messages.error( messages.error(
self.request, self.request,
GenericError( GenericError(code=GenericErrorCodes.CANNOT_CONTACT_REGISTRY),
code=GenericErrorCodes.CANNOT_CONTACT_REGISTRY
)
) )
logger.error(f"Registry connection error: {Err}") logger.error(f"Registry connection error: {Err}")
else: else:
messages.error( messages.error(
self.request, self.request, GenericError(code=GenericErrorCodes.GENERIC_ERROR)
GenericError(
code=GenericErrorCodes.GENERIC_ERROR
)
) )
logger.error(f"Registry error: {Err}") logger.error(f"Registry error: {Err}")
else: else:
@ -707,9 +699,7 @@ class DomainSecurityEmailView(DomainFormBaseView):
if contact is None: if contact is None:
messages.error( messages.error(
self.request, self.request,
GenericError( GenericError(code=GenericErrorCodes.CANNOT_CONTACT_REGISTRY),
code=GenericErrorCodes.CANNOT_CONTACT_REGISTRY
)
) )
return redirect(self.get_success_url()) return redirect(self.get_success_url())
@ -721,25 +711,17 @@ class DomainSecurityEmailView(DomainFormBaseView):
if Err.is_connection_error(): if Err.is_connection_error():
messages.error( messages.error(
self.request, self.request,
GenericError( GenericError(code=GenericErrorCodes.CANNOT_CONTACT_REGISTRY),
code=GenericErrorCodes.CANNOT_CONTACT_REGISTRY
)
) )
logger.error(f"Registry connection error: {Err}") logger.error(f"Registry connection error: {Err}")
else: else:
messages.error( messages.error(
self.request, self.request, GenericError(code=GenericErrorCodes.GENERIC_ERROR)
GenericError(
code=GenericErrorCodes.GENERIC_ERROR
)
) )
logger.error(f"Registry error: {Err}") logger.error(f"Registry error: {Err}")
except ContactError as Err: except ContactError as Err:
messages.error( messages.error(
self.request, self.request, GenericError(code=GenericErrorCodes.GENERIC_ERROR)
GenericError(
code=GenericErrorCodes.GENERIC_ERROR
)
) )
logger.error(f"Generic registry error: {Err}") logger.error(f"Generic registry error: {Err}")
else: else: