예제 #1
0
파일: fields.py 프로젝트: tai271828/maas
 def _clean_host(self, host):
     try:
         validate_hostname(host)
     except ValidationError as error:
         raise ValidationError("Invalid hostname: " + error.message)
     else:
         return host
예제 #2
0
파일: test_dns.py 프로젝트: tai271828/maas
 def assertAccepts(self, hostname):
     """Assertion: the validator accepts `hostname`."""
     try:
         validate_hostname(hostname)
     except ValidationError as e:
         raise AssertionError(str(e))