Revision 2f8bc438 ncclient/rpc/reply.py

b/ncclient/rpc/reply.py
12 12
# See the License for the specific language governing permissions and
13 13
# limitations under the License.
14 14

  
15
import ncclient
16

  
15 17
from xml.etree import cElementTree as ET
16 18

  
17 19
from ncclient.content import multiqualify as _
......
32 34
        return self._raw
33 35
    
34 36
    def parse(self):
35
        if self._parsed: return
37
        if self._parsed:
38
            return
39
        
36 40
        root = self._root = ET.fromstring(self._raw) # <rpc-reply> element
37 41
        
38 42
        if __(root.tag) != 'rpc-reply':
......
60 64
                if self._errors:
61 65
                    break
62 66
        
63
        if self.ok:
64
            # TODO: store children in some way...
65
            pass
66
        
67 67
        self._parsed = True
68 68
    
69 69
    @property
......
86 86
        return self._errors
87 87

  
88 88

  
89
class RPCError(Exception): # raise it if you like
89
class RPCError(ncclient.RPCError): # raise it if you like
90 90
    
91 91
    def __init__(self, err_dict):
92 92
        self._dict = err_dict
93 93
        if self.message is not None:
94
            Exception.__init__(self, self.message)
94
            ncclient.RPCError.__init__(self, self.message)
95 95
        else:
96
            Exception.__init__(self)
96
            ncclient.RPCError.__init__(self)
97 97
    
98 98
    @property
99 99
    def raw(self):

Also available in: Unified diff