mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-07-26 04:28:39 +02:00
Linter change
This commit is contained in:
parent
2e4fb737e3
commit
c626bd2629
1 changed files with 6 additions and 5 deletions
|
@ -31,9 +31,7 @@ class DomainHelper:
|
||||||
"""Attempt to determine if a domain name could be requested."""
|
"""Attempt to determine if a domain name could be requested."""
|
||||||
|
|
||||||
# Split into pieces for the linter
|
# Split into pieces for the linter
|
||||||
cls._throw_err_if_domain_is_not_valid_string(domain)
|
domain = cls._check_domain_string(domain)
|
||||||
|
|
||||||
domain = domain.lower().strip() # type: ignore
|
|
||||||
|
|
||||||
if domain == "" and not blank_ok:
|
if domain == "" and not blank_ok:
|
||||||
raise errors.BlankValueError()
|
raise errors.BlankValueError()
|
||||||
|
@ -58,8 +56,9 @@ class DomainHelper:
|
||||||
return domain
|
return domain
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def _throw_err_if_domain_is_not_valid_string(domain):
|
def _check_domain_string(domain):
|
||||||
"""Throws an error if a domain string is not a string"""
|
"""Checks the given domain string, and returns the domain if valid.
|
||||||
|
Otherwise, throws an error if a domain string is not a string"""
|
||||||
|
|
||||||
if domain is None:
|
if domain is None:
|
||||||
raise errors.BlankValueError()
|
raise errors.BlankValueError()
|
||||||
|
@ -67,6 +66,8 @@ class DomainHelper:
|
||||||
if not isinstance(domain, str):
|
if not isinstance(domain, str):
|
||||||
raise errors.InvalidDomainError()
|
raise errors.InvalidDomainError()
|
||||||
|
|
||||||
|
return domain.lower().strip()
|
||||||
|
|
||||||
@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