[Neo-report] r2283 vincent - in /trunk/neo/client: app.py exception.py iterator.py
nobody at svn.erp5.org
nobody at svn.erp5.org
Thu Sep 2 18:29:53 CEST 2010
Author: vincent
Date: Thu Sep 2 18:29:53 2010
New Revision: 2283
Log:
Use exception for undone creation in client.
Modified:
trunk/neo/client/app.py
trunk/neo/client/exception.py
trunk/neo/client/iterator.py
Modified: trunk/neo/client/app.py
==============================================================================
--- trunk/neo/client/app.py [iso-8859-1] (original)
+++ trunk/neo/client/app.py [iso-8859-1] Thu Sep 2 18:29:53 2010
@@ -36,7 +36,7 @@ from neo.locking import Lock
from neo.connection import MTClientConnection, OnTimeout
from neo.node import NodeManager
from neo.connector import getConnectorHandler
-from neo.client.exception import NEOStorageError
+from neo.client.exception import NEOStorageError, NEOStorageCreationUndoneError
from neo.client.exception import NEOStorageNotFoundError, ConnectionClosed
from neo.exception import NeoException
from neo.client.handlers import storage, master
@@ -466,6 +466,8 @@ class Application(object):
object exists but no data satisfies given parameters
NEOStorageDoesNotExistError
object doesn't exist
+ NEOStorageCreationUndoneError
+ object existed, but its creation was undone
"""
# TODO:
# - rename parameters (here and in handlers & packet definitions)
@@ -530,7 +532,7 @@ class Application(object):
finally:
self._cache_lock_release()
if data == '':
- data = None
+ raise NEOStorageCreationUndoneError(dump(oid))
return data, start_serial, end_serial
Modified: trunk/neo/client/exception.py
==============================================================================
--- trunk/neo/client/exception.py [iso-8859-1] (original)
+++ trunk/neo/client/exception.py [iso-8859-1] Thu Sep 2 18:29:53 2010
@@ -33,3 +33,9 @@ class NEOStorageDoesNotExistError(NEOSto
"""
pass
+class NEOStorageCreationUndoneError(NEOStorageDoesNotExistError):
+ """
+ This error is a refinement of NEOStorageDoesNotExistError: this means that
+ some object existed at some point, but its creation was undone.
+ """
+
Modified: trunk/neo/client/iterator.py
==============================================================================
--- trunk/neo/client/iterator.py [iso-8859-1] (original)
+++ trunk/neo/client/iterator.py [iso-8859-1] Thu Sep 2 18:29:53 2010
@@ -17,7 +17,7 @@
from ZODB import BaseStorage
from neo import util
-
+from neo.client.exception import NEOStorageCreationUndoneError
class Record(BaseStorage.DataRecord):
""" TBaseStorageransaction record yielded by the Transaction object """
@@ -67,7 +67,10 @@ class Transaction(BaseStorage.Transactio
oid = oid_list[oid_index]
self.oid_index = oid_index + 1
# load an object
- data, _, next_tid = app._load(oid, serial=self.tid)
+ try:
+ data, _, next_tid = app._load(oid, serial=self.tid)
+ except NEOStorageCreationUndoneError:
+ data = next_tid = None
record = Record(oid, self.tid, '', data,
self.prev_serial_dict.get(oid))
if next_tid is None:
More information about the Neo-report
mailing list