Revision c2a5b930 ncclient/operations/edit.py

b/ncclient/operations/edit.py
17 17

  
18 18
import util
19 19

  
20
"""
21
"""
22

  
23
# NOTES
24
# - consider class for helping define <config> for EditConfig??
25

  
26

  
20 27
class EditConfig(RPC):
21 28
    
22 29
    # tested: no
......
31 38
                default_operation=None, test_option=None, error_option=None):
32 39
        util.one_of(target, target_url)
33 40
        spec = EditConfig.SPEC.copy()
34
        params = spec['subtree']
35
        params.append({
41
        subtree = spec['subtree']
42
        subtree.append({
36 43
            'tag': 'target',
37 44
            'subtree': util.store_or_url(target, target_url)
38 45
            })
39
        params.append({
46
        subtree.append({
40 47
            'tag': 'config',
41 48
            'subtree': config
42 49
            })
43 50
        if default_operation is not None:
44
            params.append({
51
            subtree.append({
45 52
                'tag': 'default-operation',
46 53
                'text': default_operation
47 54
                })
48 55
        if test_option is not None:
49
            if test_option == '':
50
                self._assert(':validate')
51
            params.append({
56
            self._assert(':validate')
57
            subtree.append({
52 58
                'tag': 'test-option',
53 59
                'text': test_option
54 60
                })
55 61
        if error_option is not None:
56 62
            if error_option == 'rollback-on-error':
57 63
                self._assert(':rollback-on-error')
58
            params.append({
64
            subtree.append({
59 65
                'tag': 'error-option',
60 66
                'text': error_option
61 67
                })
......
64 70
class DeleteConfig(RPC):
65 71
    
66 72
    # tested: no
73
    # combed: yes
67 74
    
68 75
    SPEC = {
69 76
        'tag': 'delete-config',
......
79 86
class CopyConfig(RPC):
80 87
    
81 88
    # tested: no
89
    # combed: yes
82 90
    
83 91
    SPEC = {
84 92
        'tag': 'copy-config',

Also available in: Unified diff