Commit a7a0c4c6 authored by Aurel's avatar Aurel

row is by default an empty list, not a None value, so do the rigth comparison


git-svn-id: https://svn.erp5.org/repos/neo/branches/prototype3@249 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent 48b49442
...@@ -111,17 +111,16 @@ class PartitionTable(object): ...@@ -111,17 +111,16 @@ class PartitionTable(object):
self.num_filled_rows = self.np self.num_filled_rows = self.np
def setCell(self, offset, node, state): def setCell(self, offset, node, state):
if state == DISCARDED_STATE: if state == DISCARDED_STATE:
return self.removeCell(offset, node) return self.removeCell(offset, node)
if node.getState() in (BROKEN_STATE, DOWN_STATE): if node.getState() in (BROKEN_STATE, DOWN_STATE):
return return
row = self.partition_list[offset] row = self.partition_list[offset]
if row is None: if len(row) == 0:
# Create a new row. # Create a new row.
row = [Cell(node, state)] row = [Cell(node, state),]
if state != FEEDING_STATE: if state != FEEDING_STATE:
self.count_dict[node] = self.count_dict.get(node, 0) + 1 self.count_dict[node] = self.count_dict.get(node, 0) + 1
self.partition_list[offset] = row self.partition_list[offset] = row
...@@ -184,7 +183,7 @@ class PartitionTable(object): ...@@ -184,7 +183,7 @@ class PartitionTable(object):
desc_list.append('%d %s %s' % (i, cell_state, node_state)) desc_list.append('%d %s %s' % (i, cell_state, node_state))
logging.debug('pt: row %d: %s', offset, ', '.join(desc_list)) logging.debug('pt: row %d: %s', offset, ', '.join(desc_list))
def operational(self): def operational(self):
if not self.filled(): if not self.filled():
return False return False
......
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