fixed bugs in ip list handling, reformatted clean function in forms, removed custom field type for ip address in nameserverform

This commit is contained in:
David Kennedy 2023-10-25 13:00:25 -04:00
parent 46f03cd4e4
commit 517390cc55
No known key found for this signature in database
GPG key ID: 6528A5386E66B96B
5 changed files with 56 additions and 58 deletions

View file

@ -260,7 +260,7 @@ class Domain(TimeStampedModel, DomainHelper):
"""Creates the host object in the registry
doesn't add the created host to the domain
returns ErrorCode (int)"""
if addrs is not None:
if addrs is not None and addrs != []:
addresses = [epp.Ip(addr=addr) for addr in addrs]
request = commands.CreateHost(name=host, addrs=addresses)
else:
@ -314,16 +314,14 @@ class Domain(TimeStampedModel, DomainHelper):
NameserverError (if exception hit)
Returns:
None"""
if cls.isSubdomain(name, nameserver) and (ip is None or ip == [] or ip == [""]):
if cls.isSubdomain(name, nameserver) and (ip is None or ip == []):
raise NameserverError(code=nsErrorCodes.MISSING_IP, nameserver=nameserver)
elif not cls.isSubdomain(name, nameserver) and (
ip is not None and ip != [] and ip != [""]
):
elif not cls.isSubdomain(name, nameserver) and (ip is not None and ip != []):
raise NameserverError(
code=nsErrorCodes.GLUE_RECORD_NOT_ALLOWED, nameserver=nameserver, ip=ip
)
elif ip is not None and ip != [] and ip != [""]:
elif ip is not None and ip != []:
for addr in ip:
if not cls._valid_ip_addr(addr):
raise NameserverError(