Revision 40a92771 ncclient/operations/reply.py
b/ncclient/operations/reply.py | ||
---|---|---|
34 | 34 |
if self._parsed: return |
35 | 35 |
root = ET.fromstring(self._raw) # <rpc-reply> element |
36 | 36 |
|
37 |
# check if root is <rpc-reply> ?? |
|
37 |
if __(root.tag) != 'rpc-reply': |
|
38 |
raise ValueError('Root element is not RPC reply') |
|
38 | 39 |
|
39 | 40 |
# per rfc 4741 an <ok/> tag is sent when there are no errors or warnings |
40 | 41 |
oktags = _('ok') |
... | ... | |
51 | 52 |
logger.debug('parsed [%s]' % errtag) |
52 | 53 |
d = {} |
53 | 54 |
for err_detail in err.getchildren(): # <error-type> etc.. |
54 |
d[__(err_detail.tag)] = err_detail.text |
|
55 |
tag = __(err_detail.tag) |
|
56 |
d[tag] = (err_detail.text if tag != 'error-info' |
|
57 |
else ET.tostring(err_detail, 'utf-8')) |
|
55 | 58 |
self._errors.append(RPCError(d)) |
56 | 59 |
if self._errors: |
57 | 60 |
break |
Also available in: Unified diff