mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-07-24 19:48:36 +02:00
updated validation and removal of whitespace; raise RegistryErrors on create_host and update_host
This commit is contained in:
parent
89a65e597f
commit
91e2a7906b
3 changed files with 4 additions and 6 deletions
|
@ -45,6 +45,8 @@ class DomainNameserverForm(forms.Form):
|
|||
self.clean_empty_strings(cleaned_data)
|
||||
server = cleaned_data.get("server", "")
|
||||
ip = cleaned_data.get("ip", None)
|
||||
# remove ANY spaces in the ip field
|
||||
ip = ip.replace(" ", "")
|
||||
domain = cleaned_data.get("domain", "")
|
||||
|
||||
ip_list = self.extract_ip_list(ip)
|
||||
|
|
|
@ -277,7 +277,7 @@ class Domain(TimeStampedModel, DomainHelper):
|
|||
return response.code
|
||||
except RegistryError as e:
|
||||
logger.error("Error _create_host, code was %s error was %s" % (e.code, e))
|
||||
return e.code
|
||||
raise e
|
||||
|
||||
def _convert_list_to_dict(self, listToConvert: list[tuple[str, list]]):
|
||||
"""converts a list of hosts into a dictionary
|
||||
|
@ -1593,7 +1593,7 @@ class Domain(TimeStampedModel, DomainHelper):
|
|||
return response.code
|
||||
except RegistryError as e:
|
||||
logger.error("Error _update_host, code was %s error was %s" % (e.code, e))
|
||||
return e.code
|
||||
raise e
|
||||
|
||||
def addAndRemoveHostsFromDomain(
|
||||
self, hostsToAdd: list[str], hostsToDelete: list[str]
|
||||
|
|
|
@ -295,10 +295,6 @@ class DomainNameserversView(DomainFormBaseView):
|
|||
if ip_string:
|
||||
# Split the string into a list using a comma as the delimiter
|
||||
ip_list = ip_string.split(",")
|
||||
# Remove any leading or trailing whitespace from each IP in the list
|
||||
# this will return [] if no ips have been entered, which is taken
|
||||
# into account in the model in checkHostIPCombo
|
||||
ip_list = [ip.replace(" ", "").strip() for ip in ip_list]
|
||||
|
||||
as_tuple = (
|
||||
form.cleaned_data["server"],
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue