[Neo-report] r2568 vincent - in /trunk/neo: client/ storage/handlers/ tests/storage/
nobody at svn.erp5.org
nobody at svn.erp5.org
Thu Dec 23 12:03:46 CET 2010
Author: vincent
Date: Thu Dec 23 12:03:46 2010
New Revision: 2568
Log:
Answer OidNotFound to AskObjectHistory when object doesn't exist.
Modified:
trunk/neo/client/Storage.py
trunk/neo/client/app.py
trunk/neo/storage/handlers/client.py
trunk/neo/tests/storage/testClientHandler.py
Modified: trunk/neo/client/Storage.py
==============================================================================
--- trunk/neo/client/Storage.py [iso-8859-1] (original)
+++ trunk/neo/client/Storage.py [iso-8859-1] Thu Dec 23 12:03:46 2010
@@ -232,7 +232,10 @@ class Storage(BaseStorage.BaseStorage,
self.app.registerDB(db, limit)
def history(self, oid, version=None, size=1, filter=None):
- return self.app.history(oid, version, size, filter)
+ try:
+ return self.app.history(oid, version, size, filter)
+ except NEOStorageNotFoundError:
+ raise KeyError
def sync(self, force=True):
self._snapshot_tid = None
Modified: trunk/neo/client/app.py
==============================================================================
--- trunk/neo/client/app.py [iso-8859-1] (original)
+++ trunk/neo/client/app.py [iso-8859-1] Thu Dec 23 12:03:46 2010
@@ -1231,12 +1231,6 @@ class Application(object):
if not isinstance(self.local_var.history, tuple):
raise NEOStorageError('history failed')
- if self.local_var.history[1] == [] or \
- self.local_var.history[1][0][1] == 0:
- # KeyError expected if no history was found
- # XXX: this may requires an error from the storages
- raise KeyError
-
# Now that we have object informations, get txn informations
history_list = []
for serial, size in self.local_var.history[1]:
Modified: trunk/neo/storage/handlers/client.py
==============================================================================
--- trunk/neo/storage/handlers/client.py [iso-8859-1] (original)
+++ trunk/neo/storage/handlers/client.py [iso-8859-1] Thu Dec 23 12:03:46 2010
@@ -147,8 +147,10 @@ class ClientOperationHandler(BaseClientA
app = self.app
history_list = app.dm.getObjectHistory(oid, first, last - first)
if history_list is None:
- history_list = []
- conn.answer(Packets.AnswerObjectHistory(oid, history_list))
+ p = Errors.OidNotFound(dump(oid))
+ else:
+ p = Packets.AnswerObjectHistory(oid, history_list)
+ conn.answer(p)
def askCheckCurrentSerial(self, conn, tid, serial, oid):
self._askCheckCurrentSerial(conn, tid, serial, oid, time.time())
Modified: trunk/neo/tests/storage/testClientHandler.py
==============================================================================
--- trunk/neo/tests/storage/testClientHandler.py [iso-8859-1] (original)
+++ trunk/neo/tests/storage/testClientHandler.py [iso-8859-1] Thu Dec 23 12:03:46 2010
@@ -177,7 +177,7 @@ class StorageClientHandlerTests(NeoUnitT
conn = self._getConnection()
self.app.dm = Mock({'getObjectHistory': None})
self.operation.askObjectHistory(conn, oid1, 1, 2)
- self.checkAnswerObjectHistory(conn)
+ self.checkErrorPacket(conn)
# second case: not empty history
conn = self._getConnection()
serial = self.getNextTID()
More information about the Neo-report
mailing list