Revision 179b00d4 ncclient/rpc/reply.py
b/ncclient/rpc/reply.py | ||
---|---|---|
24 | 24 |
|
25 | 25 |
class RPCReply: |
26 | 26 |
|
27 |
'NOTES: memory considerations?? storing both raw xml + ET.Element' |
|
28 |
|
|
27 | 29 |
def __init__(self, raw): |
28 | 30 |
self._raw = raw |
29 | 31 |
self._parsed = False |
... | ... | |
67 | 69 |
self._parsed = True |
68 | 70 |
|
69 | 71 |
@property |
70 |
def raw(self): |
|
72 |
def content_xml(self): |
|
73 |
'<rpc-reply> subtree' |
|
74 |
if not self._parsed: self.parse() |
|
75 |
return ''.join([ET.tostring(ele) for ele in self._root.getchildren()]) |
|
76 |
|
|
77 |
@property |
|
78 |
def content_element(self): |
|
79 |
if not self._parsed: self.parse() |
|
80 |
return self._root.getchildren() |
|
81 |
|
|
82 |
@property |
|
83 |
def root_xml(self): |
|
84 |
'<rpc-reply> as returned' |
|
71 | 85 |
return self._raw |
72 | 86 |
|
73 | 87 |
@property |
74 |
def root(self): |
|
88 |
def root_element(self): |
|
89 |
if not self._parsed: self.parse() |
|
75 | 90 |
return self._root |
76 | 91 |
|
77 | 92 |
@property |
... | ... | |
80 | 95 |
return not self._errors # empty list => false |
81 | 96 |
|
82 | 97 |
@property |
98 |
def error(self): |
|
99 |
if not self._parsed: self.parse() |
|
100 |
if self._errors: |
|
101 |
return self._errors[0] |
|
102 |
else: |
|
103 |
return None |
|
104 |
|
|
105 |
@property |
|
83 | 106 |
def errors(self): |
84 | 107 |
'List of RPCError objects. Will be empty if no <rpc-error> elements in reply.' |
85 | 108 |
if not self._parsed: self.parse() |
Also available in: Unified diff