diff src/memory/memory.py @ 833:9bac2fc74968

memory: bug fix to not register twice frontends parameters + added some tests for param update
author souliane <souliane@mailoo.org>
date Fri, 07 Feb 2014 17:10:24 +0100
parents 1a1600491d9d
children f3513c8cc2e6
line wrap: on
line diff
--- a/src/memory/memory.py	Wed Feb 05 16:36:51 2014 +0100
+++ b/src/memory/memory.py	Fri Feb 07 17:10:24 2014 +0100
@@ -296,7 +296,7 @@
         return None
 
     def updateParams(self, xml, security_limit=NO_SECURITY_LIMIT, app=''):
-        """import xml in parameters, do nothing if the param already exist
+        """import xml in parameters, update if the param already exists
         If security_limit is specified and greater than -1, the parameters
         that have a security level greater than security_limit are skipped.
         @param xml: parameters in xml form
@@ -339,7 +339,7 @@
                     tgt_parent.appendChild(child)
                 else:
                     if child.nodeName == "param":
-                        # The child update an existing parameter, we replace the node
+                        # The child updates an existing parameter, we replace the node
                         tgt_parent.replaceChild(child, node)
                     else:
                         # the node already exists, we recurse 1 more level
@@ -361,10 +361,11 @@
             warning(_("Trying to register frontends parameters with no specified app: aborted"))
             return
         if not hasattr(self, "frontends_cache"):
-            self.frontends_cache = {}
+            self.frontends_cache = []
         if app in self.frontends_cache:
-            warning(_("Trying to register twice frontends parameters for %(app)s: aborted" % {"app": app}))
+            debug(_("Trying to register twice frontends parameters for %(app)s: aborted" % {"app": app}))
             return
+        self.frontends_cache.append(app)
         self.updateParams(xml, security_limit, app)
         debug("Frontends parameters registered for %(app)s" % {'app': app})