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):
conn.answer(Packets.AnswerLastIDs(oid, tid, app.pt.getID()))
def askPartitionTable(self, conn, offset_list):
app, pt = self.app, self.app.pt
if not offset_list:
# all is requested
offset_list = xrange(0, self.app.pt.getPartitions())
row_list = []
try:
for offset in offset_list:
row = []
# TODO: remove try..except: pass
try:
for cell in app.pt.getCellList(offset):
row.append((cell.getUUID(), cell.getState()))
except TypeError:
pass
row_list.append((offset, row))
except IndexError:
raise protocol.ProtocolError('invalid partition table offset')
conn.answer(Packets.AnswerPartitionTable(app.pt.getID(), row_list))
else:
if max(offset_list) >= self.app.pt.getPartitions():
raise protocol.ProtocolError('invalid partition table offset')
# build a table with requested partitions
row_list = [(offset, [(cell.getUUID(), cell.getState())
for cell in self.app.pt.getCellList(offset)])
for offset in offset_list]
conn.answer(Packets.AnswerPartitionTable(self.app.pt.getID(), row_list))
def notifyPartitionChanges(self, conn, ptid, cell_list):
"""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