mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-08-16 14:34:10 +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
|
@classmethod
|
||||||
def validate(cls, domain: str | None, blank_ok=False) -> str:
|
def validate(cls, domain: str | None, blank_ok=False) -> str:
|
||||||
"""Attempt to determine if a domain name could be requested."""
|
"""Attempt to determine if a domain name could be requested."""
|
||||||
if domain is None:
|
|
||||||
raise errors.BlankValueError()
|
# Split into pieces for the linter
|
||||||
if not isinstance(domain, str):
|
cls._throw_err_if_domain_is_string(domain)
|
||||||
raise errors.InvalidDomainError("Domain name must be a string")
|
|
||||||
|
|
||||||
domain = domain.lower().strip()
|
domain = domain.lower().strip()
|
||||||
|
|
||||||
|
@ -58,6 +57,16 @@ class DomainHelper:
|
||||||
raise errors.RegistrySystemError() from err
|
raise errors.RegistrySystemError() from err
|
||||||
return domain
|
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
|
@classmethod
|
||||||
def validate_and_handle_errors(cls, domain, return_type, blank_ok=False):
|
def validate_and_handle_errors(cls, domain, return_type, blank_ok=False):
|
||||||
"""
|
"""
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue