comparison src/memory/params.py @ 1050:de415d7984f7

memory (params), test: fixes bug relative to parameter filtering
author souliane <souliane@mailoo.org>
date Tue, 03 Jun 2014 15:10:51 +0200
parents 85c110c0be86
children 854880a31717
comparison
equal deleted inserted replaced
1049:9e24ca275ddd 1050:de415d7984f7
544 category = cat_node.getAttribute('name') 544 category = cat_node.getAttribute('name')
545 dest_params = {} # result (merged) params for category 545 dest_params = {} # result (merged) params for category
546 if category not in cache: 546 if category not in cache:
547 # we make a copy for the new xml 547 # we make a copy for the new xml
548 cache[category] = dest_cat = cat_node.cloneNode(True) 548 cache[category] = dest_cat = cat_node.cloneNode(True)
549 to_remove = []
549 for node in dest_cat.childNodes: 550 for node in dest_cat.childNodes:
550 if node.nodeName != "param": 551 if node.nodeName != "param":
551 continue 552 continue
552 if not checkNode(node): 553 if not checkNode(node):
553 dest_cat.removeChild(node) 554 to_remove.append(node)
554 continue 555 continue
555 dest_params[node.getAttribute('name')] = node 556 dest_params[node.getAttribute('name')] = node
557 for node in to_remove:
558 dest_cat.removeChild(node)
556 new_node = True 559 new_node = True
557 else: 560 else:
558 # It's not a new node, we use the previously cloned one 561 # It's not a new node, we use the previously cloned one
559 dest_cat = cache[category] 562 dest_cat = cache[category]
560 new_node = False 563 new_node = False