From 040a4df4fa42f5fcc808da2600ea7a37d0973bcb Mon Sep 17 00:00:00 2001 From: Kevin Rocard Date: Tue, 5 Feb 2013 18:21:56 +0100 Subject: PFW: Wrong rule order in generated xml file BZ: 85553 The xml generator was inverting inherited rule, this patch corrects it. Rules are now ordered in the inheritance order. Rule inherited from high level element are now at the beginning of the rule list. It is only a cosmetic change a functional change. Change-Id: I5c718a93d24c64ec690377915a98404823cf8fba Signed-off-by: Kevin Rocard Reviewed-on: http://android.intel.com:8080/90354 Reviewed-by: cactus Reviewed-by: Centelles, Sylvain Reviewed-by: Denneulin, Guillaume Tested-by: Dixon, CharlesX Reviewed-by: buildbot Tested-by: buildbot --- tools/xmlGenerator/PFWScriptGenerator.py | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) (limited to 'tools') diff --git a/tools/xmlGenerator/PFWScriptGenerator.py b/tools/xmlGenerator/PFWScriptGenerator.py index bef427e..ff83ed3 100755 --- a/tools/xmlGenerator/PFWScriptGenerator.py +++ b/tools/xmlGenerator/PFWScriptGenerator.py @@ -231,20 +231,22 @@ class Element: # If no exception was raised, add child to child list if append : - position = len(self.children) + self.children.append(child) else : - position = 0 - - self.children.insert(position , child) + self.children.insert(0, child) except ValueError: # the child class is not in the white list raise ChildNotPermitedError("", self, child) def addChildren(self, children, append=True) : - """add a list of child""" - for child in children : - self.addChild(child, append) + """Add a list of child""" + if append: + # Add children at the end of the child list + self.children.extend(children) + else: + # Add children at the begining of the child list + self.children = children + self.children def childrenToXML(self, prefix=""): """return XML printed children""" @@ -350,10 +352,10 @@ class ElementWithRuleInheritance(ElementWithInheritance): # get context rules contextRules = context.getRules() - # adopt rules of the context - self.addChildren(contextRules) + # adopt rules of the beginning of the context + self.addChildren(contextRules, append=False) - # add previously extract rules the context + # add previously extract rules to the context contextRules += childRules -- cgit v1.1