Attention une mise à jour du service Gitlab va être effectuée le mardi 30 novembre entre 17h30 et 18h00. Cette mise à jour va générer une interruption du service dont nous ne maîtrisons pas complètement la durée mais qui ne devrait pas excéder quelques minutes. Cette mise à jour intermédiaire en version 14.0.12 nous permettra de rapidement pouvoir mettre à votre disposition une version plus récente.

Commit bcd4532f authored by VIGNET Pierre's avatar VIGNET Pierre
Browse files

[lib] Fix bug in the reloading of MacroNodes

the sub-nodes were attached to the general MacroNode not to the current MacroNode
parent a2a5a7e0
......@@ -332,18 +332,29 @@ class MakeHandler(ContentHandler):
# Encoding of node names
self.encoding = "ascii"
def init_node_functions(self):
def init_node_functions(self, top_pile=None):
"""Bind functions to add different types of nodes to the cadbiom model
.. note:: Must be call after the init of self.top_pile with the xml root
object.
.. note:: If called when a MacroNode is encountered; must be called
when the end-tag is encountered with the parent node set in top_pile
argument.
:param top_pile: If set, all futures nodes will belong to this node.
It is used for MacroNodes: all subnodes belong to them.
:type top_pile: <CNode>
"""
if not top_pile:
top_pile = self.top_pile
self.add_node_functions = {
"CStartNode": self.top_pile.add_start_node,
"CTrapNode": self.top_pile.add_trap_node,
"CSimpleNode": self.top_pile.add_simple_node,
"CPermNode": self.top_pile.add_perm_node,
"CInputNode": self.top_pile.add_input_node,
"CStartNode": top_pile.add_start_node,
"CTrapNode": top_pile.add_trap_node,
"CSimpleNode": top_pile.add_simple_node,
"CPermNode": top_pile.add_perm_node,
"CInputNode": top_pile.add_input_node,
}
def startElement(self, name, att):
......@@ -425,6 +436,9 @@ class MakeHandler(ContentHandler):
self.top_pile = node
self.node_dict = new_node_dict
# Future nodes belong to this MacroNode
self.init_node_functions(top_pile=node)
elif name == "constraints":
self.in_constraints = True
self.constraints = ""
......@@ -480,6 +494,10 @@ class MakeHandler(ContentHandler):
# self.top_pile = self.pile_node.pop()
self.pile_node.remove(self.top_pile)
self.top_pile = self.pile_node[-1]
# Future nodes belong to the parent of this MacroNode
self.init_node_functions()
# self.node_dict = self.pile_dict.pop()
self.pile_dict.remove(self.node_dict)
self.node_dict = self.pile_dict[-1]
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment