mirror of
https://github.com/virt-manager/virt-manager.git
synced 2024-12-22 13:34:07 +03:00
xmlbuilder: Opencode single addnode= usage
This commit is contained in:
parent
559e813b96
commit
a931a1a6ad
@ -156,7 +156,7 @@ def _add_pretty_child(parentnode, newnode):
|
||||
return newnode
|
||||
|
||||
|
||||
def _build_xpath_node(ctx, xpath, addnode=None):
|
||||
def _build_xpath_node(ctx, xpath):
|
||||
"""
|
||||
Build all nodes required to set an xpath. If we have XML <foo/>, and want
|
||||
to set xpath /foo/bar/baz@booyeah, we create node 'bar' and 'baz'
|
||||
@ -197,9 +197,6 @@ def _build_xpath_node(ctx, xpath, addnode=None):
|
||||
newnode = libxml2.newNode(nodename)
|
||||
parentnode = _add_pretty_child(parentnode, newnode)
|
||||
|
||||
if addnode:
|
||||
parentnode = _add_pretty_child(parentnode, addnode)
|
||||
|
||||
return parentnode
|
||||
|
||||
|
||||
@ -989,7 +986,9 @@ class XMLBuilder(object):
|
||||
use_xpath = obj.get_root_xpath().rsplit("/", 1)[0]
|
||||
indent = 2 * obj.get_root_xpath().count("/")
|
||||
newnode = libxml2.parseDoc(util.xml_indent(xml, indent)).children
|
||||
_build_xpath_node(self._xmlstate.xml_ctx, use_xpath, newnode)
|
||||
parentnode = _build_xpath_node(self._xmlstate.xml_ctx, use_xpath)
|
||||
# Tack newnode on the end
|
||||
_add_pretty_child(parentnode, newnode)
|
||||
obj._parse_with_children(None, self._xmlstate.xml_node)
|
||||
|
||||
def remove_child(self, obj):
|
||||
|
Loading…
Reference in New Issue
Block a user