Return tuple and do error mapping

This commit is contained in:
zandercymatics 2024-01-09 14:07:41 -07:00
parent 6b6aed8f24
commit ce361cdd3b
No known key found for this signature in database
GPG key ID: FF4636ABEC9682B7
3 changed files with 25 additions and 30 deletions

View file

@ -383,7 +383,7 @@ class AlternativeDomainForm(RegistrarForm):
def clean_alternative_domain(self):
"""Validation code for domain names."""
requested = self.cleaned_data.get("alternative_domain", None)
validated = DraftDomain.validate_and_handle_errors(
validated, _ = DraftDomain.validate_and_handle_errors(
requested, ValidationErrorReturnType.FORM_VALIDATION_ERROR, blank_ok=True
)
return validated
@ -461,7 +461,7 @@ class DotGovDomainForm(RegistrarForm):
def clean_requested_domain(self):
"""Validation code for domain names."""
requested = self.cleaned_data.get("requested_domain", None)
validated = DraftDomain.validate_and_handle_errors(requested, ValidationErrorReturnType.FORM_VALIDATION_ERROR)
validated, _ = DraftDomain.validate_and_handle_errors(requested, ValidationErrorReturnType.FORM_VALIDATION_ERROR)
return validated
requested_domain = forms.CharField(label="What .gov domain do you want?")