Commit 26d520b0 authored by Grégory Wisniewski's avatar Grégory Wisniewski

Use pop(0) instead of reverse + pop() on a list.

git-svn-id: https://svn.erp5.org/repos/neo/trunk@2182 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent 7013135c
......@@ -410,7 +410,7 @@ class Application(object):
self._askPrimary(Packets.AskNewOIDs(100))
if len(self.new_oid_list) <= 0:
raise NEOStorageError('new_oid failed')
self.last_oid = self.new_oid_list.pop()
self.last_oid = self.new_oid_list.pop(0)
return self.last_oid
finally:
self._oid_lock_release()
......
......@@ -163,7 +163,6 @@ class PrimaryAnswersHandler(AnswerBaseHandler):
def answerNewOIDs(self, conn, oid_list):
self.app.new_oid_list = oid_list
self.app.new_oid_list.reverse()
def answerTransactionFinished(self, conn, tid):
if tid != self.app.getTID():
......
......@@ -238,7 +238,7 @@ class MasterAnswersHandlerTests(MasterHandlerTests):
conn = self.getConnection()
oid1, oid2, oid3 = self.getOID(0), self.getOID(1), self.getOID(2)
self.handler.answerNewOIDs(conn, [oid1, oid2, oid3])
self.assertEqual(self.app.new_oid_list, [oid3, oid2, oid1])
self.assertEqual(self.app.new_oid_list, [oid1, oid2, oid3])
def test_answerTransactionFinished(self):
conn = self.getConnection()
......
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