def isInvalid(self): if self.domain and not check_domain(self.domain): return "domain is invalid" if not self.nameserver1 and not self.nameserver2: return "one name server required" if self.nameserver1 == self.nameserver2: return "nameservers 1 and 2 are identical" for value in (self.nameserver1, self.nameserver2): if value: error = "invalid IP: '%s'" % value if not check_ip(value): return error try: dns = IP(value) except: return error return False
def check_ip(self, value): return check_ip(value)