Revision 188649fa ncclient/operations/util.py

b/ncclient/operations/util.py
44 44
    type = None
45 45
    if isinstance(spec, tuple):
46 46
        type, criteria = spec
47
        rep = {
48
            'tag': 'filter',
49
            'attrib': {'type': type},
50
            'subtree': criteria
51
        }
47
        rep = {'tag': 'filter', 'attrib': {'type': type}}
48
        if type == 'xpath':
49
            rep['attrib']['select'] = criteria
50
        elif type == 'subtree':
51
            rep['subtree'] = criteria
52
        else:
53
            raise OperationError("Invalid filter type")
52 54
    else:
53 55
        rep = content.validated_element(spec, ['filter', content.qualify('filter')],
54 56
                                        attrs=[('type', content.qualify('type'))])
55
        try:
56
            type = rep['type']
57
        except KeyError:
58
            type = ele[content.qualify('type')]
59 57
    if type == 'xpath' and capcheck is not None:
60 58
        capcheck(':xpath')
61 59
    return rep

Also available in: Unified diff