mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-08-05 17:28:31 +02:00
Linter change
This commit is contained in:
parent
c816cb9409
commit
6040e3e312
1 changed files with 14 additions and 5 deletions
|
@ -29,10 +29,9 @@ class DomainHelper:
|
|||
@classmethod
|
||||
def validate(cls, domain: str | None, blank_ok=False) -> str:
|
||||
"""Attempt to determine if a domain name could be requested."""
|
||||
if domain is None:
|
||||
raise errors.BlankValueError()
|
||||
if not isinstance(domain, str):
|
||||
raise errors.InvalidDomainError("Domain name must be a string")
|
||||
|
||||
# Split into pieces for the linter
|
||||
cls._throw_err_if_domain_is_string(domain)
|
||||
|
||||
domain = domain.lower().strip()
|
||||
|
||||
|
@ -40,7 +39,7 @@ class DomainHelper:
|
|||
raise errors.BlankValueError()
|
||||
elif domain == "":
|
||||
# If blank ok is true, just return the domain
|
||||
return domain
|
||||
return domain
|
||||
|
||||
if domain.endswith(".gov"):
|
||||
domain = domain[:-4]
|
||||
|
@ -58,6 +57,16 @@ class DomainHelper:
|
|||
raise errors.RegistrySystemError() from err
|
||||
return domain
|
||||
|
||||
@staticmethod
|
||||
def _throw_err_if_domain_is_string(domain):
|
||||
"""Throws an error if a domain string is not a string"""
|
||||
|
||||
if domain is None:
|
||||
raise errors.BlankValueError()
|
||||
|
||||
if not isinstance(domain, str):
|
||||
raise errors.InvalidDomainError()
|
||||
|
||||
@classmethod
|
||||
def validate_and_handle_errors(cls, domain, return_type, blank_ok=False):
|
||||
"""
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue