Package turbomail :: Module email_validator :: Class DomainValidator
[hide private]
[frames] | no frames]

Class DomainValidator

source code

   object --+    
            |    
BaseValidator --+
                |
               DomainValidator
Known Subclasses:

A domain name validator that is ready for internationalized domains.

http://en.wikipedia.org/wiki/Internationalized_domain_name http://en.wikipedia.org/wiki/Top-level_domain

Instance Methods [hide private]
 
__init__(self, fix=False, lookup_dns=None)
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
source code
 
_apply_common_rules(self, part, maxlength)
This method contains the rules that must be applied to both the domain and the local part of the e-mail address.
source code
 
validate_domain(self, part) source code
 
validate(self, part) source code
 
lookup_domain(self, domain, lookup_record=None)
Looks up the DNS record for *domain* and returns:
source code

Inherited from BaseValidator: validate_or_raise

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Class Variables [hide private]
  domain_pattern = '[\\w]+([\\w\\.\\-]+\\w)?'
  domain_regex = re.compile(r'(?iu)^\w+([\w\.-]+\w)?$')
  false_positive_ips = ['208.67.217.132']
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, fix=False, lookup_dns=None)
(Constructor)

source code 

x.__init__(...) initializes x; see x.__class__.__doc__ for signature

Overrides: object.__init__
(inherited documentation)

lookup_domain(self, domain, lookup_record=None)

source code 

Looks up the DNS record for *domain* and returns:

* None if it does not exist, * The IP address if looking up the "A" record, or * The list of hosts in the "MX" record.

The return value, if treated as a boolean, says whether a domain exists.

You can pass "a" or "mx" as the *lookup_record* parameter. Otherwise, the *lookup_dns* parameter from the constructor is used. "a" means verify that the domain exists. "mx" means verify that the domain exists and specifies mail servers.