Commit a139a328 authored by Grégory Wisniewski's avatar Grégory Wisniewski

Remove try/except blocks.

The outer try/except purpose was to check if given offset list contains
only valid ones. Check this before gathering partitions.
The inner try/except scope is two much, as it cannot be explained, remove it.

git-svn-id: https://svn.erp5.org/repos/neo/trunk@1739 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent 8b0f8857
...@@ -33,25 +33,19 @@ class VerificationHandler(BaseMasterHandler): ...@@ -33,25 +33,19 @@ class VerificationHandler(BaseMasterHandler):
conn.answer(Packets.AnswerLastIDs(oid, tid, app.pt.getID())) conn.answer(Packets.AnswerLastIDs(oid, tid, app.pt.getID()))
def askPartitionTable(self, conn, offset_list): def askPartitionTable(self, conn, offset_list):
app, pt = self.app, self.app.pt
if not offset_list: if not offset_list:
# all is requested # all is requested
offset_list = xrange(0, self.app.pt.getPartitions()) offset_list = xrange(0, self.app.pt.getPartitions())
row_list = [] else:
try: if max(offset_list) >= self.app.pt.getPartitions():
for offset in offset_list: raise protocol.ProtocolError('invalid partition table offset')
row = []
# TODO: remove try..except: pass # build a table with requested partitions
try: row_list = [(offset, [(cell.getUUID(), cell.getState())
for cell in app.pt.getCellList(offset): for cell in self.app.pt.getCellList(offset)])
row.append((cell.getUUID(), cell.getState())) for offset in offset_list]
except TypeError:
pass conn.answer(Packets.AnswerPartitionTable(self.app.pt.getID(), row_list))
row_list.append((offset, row))
except IndexError:
raise protocol.ProtocolError('invalid partition table offset')
conn.answer(Packets.AnswerPartitionTable(app.pt.getID(), row_list))
def notifyPartitionChanges(self, conn, ptid, cell_list): def notifyPartitionChanges(self, conn, ptid, cell_list):
"""This is very similar to Send Partition Table, except that """This is very similar to Send Partition Table, except that
......
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