Пример #1
0
def validate_url_container(container):
    """validate a potentially nested collection of urls."""
    if isinstance(container, string_types):
        url = container
        return validate_url(url)
    elif isinstance(container, dict):
        container = itervalues(container)

    for element in container:
        validate_url_container(element)
Пример #2
0
def validate_url_container(container):
    """validate a potentially nested collection of urls."""
    if isinstance(container, string_types):
        url = container
        return validate_url(url)
    elif isinstance(container, dict):
        container = itervalues(container)
    
    for element in container:
        validate_url_container(element)
Пример #3
0
    def _match(self, check):
        """Find all the matches for a check dict."""
        matches = []
        tests = {}
        for k, v in iteritems(check):
            if isinstance(v, dict):
                tests[k] = CompositeFilter(v)
            else:
                tests[k] = lambda o: o == v

        for rec in itervalues(self._records):
            if self._match_one(rec, tests):
                matches.append(deepcopy(rec))
        return matches
Пример #4
0
    def _match(self, check):
        """Find all the matches for a check dict."""
        matches = []
        tests = {}
        for k,v in iteritems(check):
            if isinstance(v, dict):
                tests[k] = CompositeFilter(v)
            else:
                tests[k] = lambda o: o==v

        for rec in itervalues(self._records):
            if self._match_one(rec, tests):
                matches.append(deepcopy(rec))
        return matches