示例#1
0
文件: models.py 项目: ngokevin/cyder
def _name_to_domain(fqdn):
    _name_type_check(fqdn)
    labels = fqdn.split(".")
    for i in range(len(labels)):
        name = ".".join(labels[i:])
        longest_match = Domain.objects.filter(name=name)
        if longest_match:
            return longest_match[0]
    return None
示例#2
0
文件: utils.py 项目: OSU-Net/cyder
def name_to_domain(fqdn):
    """
    This function doesn't throw an exception if nothing is found.
    """
    Domain = get_model('cyder', 'domain')
    _name_type_check(fqdn)
    labels = fqdn.split('.')
    for i in xrange(len(labels)):
        name = '.'.join(labels[i:])
        longest_match = Domain.objects.filter(name=name)
        if longest_match:
            return longest_match[0]
    return None
示例#3
0
def name_to_domain(fqdn):
    """
    This function doesn't throw an exception if nothing is found.
    """
    Domain = get_model('cyder', 'domain')
    _name_type_check(fqdn)
    labels = fqdn.split('.')
    for i in xrange(len(labels)):
        name = '.'.join(labels[i:])
        longest_match = Domain.objects.filter(name=name)
        if longest_match:
            return longest_match[0]
    return None
示例#4
0
文件: utils.py 项目: ngokevin/chili
def name_to_domain(fqdn):
    """
    This function doesn't throw an exception if nothing is found.
    """
    from cyder.cydns.domain.models import Domain

    _name_type_check(fqdn)
    labels = fqdn.split(".")
    for i in xrange(len(labels)):
        name = ".".join(labels[i:])
        longest_match = Domain.objects.filter(name=name)
        if longest_match:
            return longest_match[0]
    return None