Commit 704ff1af authored by Grégory Wisniewski's avatar Grégory Wisniewski

Raise if the locking/unlocking transaction is unknown.

git-svn-id: https://svn.erp5.org/repos/neo/trunk@1635 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent 924c2f7e
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
from neo import logging from neo import logging
from neo.protocol import CellStates, Packets from neo.protocol import CellStates, Packets, ProtocolError
from neo.storage.handlers import BaseMasterHandler from neo.storage.handlers import BaseMasterHandler
from neo.exception import OperationFailure from neo.exception import OperationFailure
...@@ -57,7 +57,9 @@ class MasterOperationHandler(BaseMasterHandler): ...@@ -57,7 +57,9 @@ class MasterOperationHandler(BaseMasterHandler):
app.replicator.addPartition(offset) app.replicator.addPartition(offset)
def lockInformation(self, conn, tid): def lockInformation(self, conn, tid):
t = self.app.transaction_dict[tid] t = self.app.transaction_dict.get(tid, None)
if t is None:
raise ProtocolError('Unknown transaction')
t.setLocked() t.setLocked()
object_list = t.getObjectList() object_list = t.getObjectList()
for o in object_list: for o in object_list:
...@@ -67,7 +69,9 @@ class MasterOperationHandler(BaseMasterHandler): ...@@ -67,7 +69,9 @@ class MasterOperationHandler(BaseMasterHandler):
conn.answer(Packets.AnswerInformationLocked(tid)) conn.answer(Packets.AnswerInformationLocked(tid))
def notifyUnlockInformation(self, conn, tid): def notifyUnlockInformation(self, conn, tid):
t = self.app.transaction_dict[tid] t = self.app.transaction_dict.get(tid, None)
if t is None:
raise ProtocolError('Unknown transaction')
object_list = t.getObjectList() object_list = t.getObjectList()
for o in object_list: for o in object_list:
oid = o[0] oid = o[0]
......
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