Revision 2acc860a ncclient/capabilities.py

b/ncclient/capabilities.py
25 25
    def __contains__(self, key):
26 26
        return ( key in self._dict ) or ( key in self._dict.values() )
27 27
    
28
    def __iter__(self):
29
        return self._dict.keys().__iter__()
30
    
28 31
    def __repr__(self):
29
        return self.to_xml()
32
        return repr(self._dict.keys())
30 33
    
31 34
    def add(self, uri, shorthand=None):
32 35
        if shorthand is None:
......
44 47
                    del self._dict[uri]
45 48
                    break
46 49
    
47
    def to_xml(self):
48
        elems = ['<capability>%s</capability>' % uri for uri in self._dict]
49
        return ('<capabilities>%s</capabilities>' % ''.join(elems))
50
    
51 50
    @staticmethod
52 51
    def guess_shorthand(uri):
53 52
        if uri.startswith('urn:ietf:params:netconf:capability:'):
......
69 68
    ])
70 69

  
71 70
if __name__ == "__main__":
72
    assert(':validate' in CAPABILITIES) # test __contains__
73
    print CAPABILITIES # test __repr__
71
    assert(':validate' in CAPABILITIES) # test __contains__

Also available in: Unified diff