Commit 0bcad6d5 authored by Vincent Pelletier's avatar Vincent Pelletier

Use UUID instead of Node class instance as dictionnary keys.

Make display order of nodes more natural (saves from iterating in node list a second time and factorises code a bit).


git-svn-id: https://svn.erp5.org/repos/neo/branches/prototype3@1067 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent 4244140f
...@@ -215,9 +215,9 @@ class PartitionTable(object): ...@@ -215,9 +215,9 @@ class PartitionTable(object):
node_list.sort() node_list.sort()
node_dict = {} node_dict = {}
for i, node in enumerate(node_list): for i, node in enumerate(node_list):
node_dict[node] = i uuid = node.getUUID()
for node, i in node_dict.iteritems(): node_dict[uuid] = i
logging.debug('pt: node %d: %s, %s', i, dump(node.getUUID()), logging.debug('pt: node %d: %s, %s', i, dump(uuid),
node_state_dict[node.getState()]) node_state_dict[node.getState()])
line = [] line = []
max_line_len = 20 # XXX: hardcoded number of partitions per line max_line_len = 20 # XXX: hardcoded number of partitions per line
...@@ -230,7 +230,7 @@ class PartitionTable(object): ...@@ -230,7 +230,7 @@ class PartitionTable(object):
line.append('X' * len(node_list)) line.append('X' * len(node_list))
else: else:
cell = [] cell = []
cell_dict = dict([(node_dict[x.getNode()], x) for x in row]) cell_dict = dict([(node_dict[x.getUUID()], x) for x in row])
for node in xrange(len(node_list)): for node in xrange(len(node_list)):
if node in cell_dict: if node in cell_dict:
cell.append(cell_state_dict[cell_dict[node].getState()]) cell.append(cell_state_dict[cell_dict[node].getState()])
......
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