Revision 2abf9522
b/ncclient/operations/edit.py | ||
---|---|---|
58 | 58 |
spec = deepcopy(EditConfig.SPEC) |
59 | 59 |
subtree = spec['subtree'] |
60 | 60 |
subtree.append(util.store_or_url('target', target, self._assert)) |
61 |
if default_operation is not None: |
|
61 |
if error_option is not None: |
|
62 |
if error_option == 'rollback-on-error': |
|
63 |
self._assert(':rollback-on-error') |
|
62 | 64 |
subtree.append({ |
63 |
'tag': 'default-operation',
|
|
64 |
'text': default_operation
|
|
65 |
'tag': 'error-option',
|
|
66 |
'text': error_option
|
|
65 | 67 |
}) |
66 | 68 |
if test_option is not None: |
67 | 69 |
self._assert(':validate') |
... | ... | |
69 | 71 |
'tag': 'test-option', |
70 | 72 |
'text': test_option |
71 | 73 |
}) |
72 |
if error_option is not None: |
|
73 |
if error_option == 'rollback-on-error': |
|
74 |
self._assert(':rollback-on-error') |
|
74 |
if default_operation is not None: |
|
75 | 75 |
subtree.append({ |
76 |
'tag': 'error-option',
|
|
77 |
'text': error_option
|
|
76 |
'tag': 'default-operation',
|
|
77 |
'text': default_operation
|
|
78 | 78 |
}) |
79 | 79 |
subtree.append(content.validated_element(config, ('config', content.qualify('config')))) |
80 | 80 |
return self._request(spec) |
b/ncclient/operations/rpc.py | ||
---|---|---|
113 | 113 |
class RPCError(OperationError): # raise it if you like |
114 | 114 |
|
115 | 115 |
"""Represents an *<rpc-error>*. It is an instance of :exc:`OperationError` |
116 |
so it can be raised like any other exception."""
|
|
116 |
and can be raised like any other exception."""
|
|
117 | 117 |
|
118 | 118 |
def __init__(self, err_dict): |
119 | 119 |
self._dict = err_dict |
... | ... | |
124 | 124 |
|
125 | 125 |
@property |
126 | 126 |
def type(self): |
127 |
"`string` represeting *error-type* element"
|
|
127 |
"`string` representing text of *error-type* element"
|
|
128 | 128 |
return self.get('error-type', None) |
129 | 129 |
|
130 | 130 |
@property |
131 | 131 |
def severity(self): |
132 |
"`string` represeting *error-severity* element"
|
|
132 |
"`string` representing text of *error-severity* element"
|
|
133 | 133 |
return self.get('error-severity', None) |
134 | 134 |
|
135 | 135 |
@property |
136 | 136 |
def tag(self): |
137 |
"`string` represeting *error-tag* element"
|
|
137 |
"`string` representing text of *error-tag* element"
|
|
138 | 138 |
return self.get('error-tag', None) |
139 | 139 |
|
140 | 140 |
@property |
141 | 141 |
def path(self): |
142 |
"`string` or :const:`None`; represeting *error-path* element"
|
|
142 |
"`string` or :const:`None`; representing text of *error-path* element"
|
|
143 | 143 |
return self.get('error-path', None) |
144 | 144 |
|
145 | 145 |
@property |
146 | 146 |
def message(self): |
147 |
"`string` or :const:`None`; represeting *error-message* element"
|
|
147 |
"`string` or :const:`None`; representing text of *error-message* element"
|
|
148 | 148 |
return self.get('error-message', None) |
149 | 149 |
|
150 | 150 |
@property |
151 | 151 |
def info(self): |
152 |
"`string` or :const:`None`, represeting *error-info* element"
|
|
152 |
"`string` (XML) or :const:`None`, representing *error-info* element"
|
|
153 | 153 |
return self.get('error-info', None) |
154 | 154 |
|
155 | 155 |
## dictionary interface |
Also available in: Unified diff