Revision 38a9b062 ncclient/capability.py
b/ncclient/capability.py | ||
---|---|---|
26 | 26 |
return ( key in self._dict ) or ( key in self._dict.values() ) |
27 | 27 |
|
28 | 28 |
def __repr__(self): |
29 |
elems = ['<capability>%s</capability>' % uri for uri in self._dict] |
|
30 |
return ('<capabilities>%s</capabilities>' % ''.join(elems)) |
|
29 |
return self.to_xml() |
|
31 | 30 |
|
32 | 31 |
def add(self, uri, shorthand=None): |
33 | 32 |
if shorthand is None: |
... | ... | |
44 | 43 |
if self._dict[uri] == key: |
45 | 44 |
del self._dict[uri] |
46 | 45 |
break |
47 |
|
|
46 |
|
|
47 |
def to_xml(self): |
|
48 |
elems = ['<capability>%s</capability>' % uri for uri in self._dict] |
|
49 |
return ('<capabilities>%s</capabilities>' % ''.join(elems)) |
|
50 |
|
|
48 | 51 |
@staticmethod |
49 | 52 |
def guess_shorthand(uri): |
50 | 53 |
if uri.startswith('urn:ietf:params:netconf:capability:'): |
Also available in: Unified diff