Commit 1f1dc176 authored by Vincent Pelletier's avatar Vincent Pelletier

Use exception for undone creation in client.

git-svn-id: https://svn.erp5.org/repos/neo/trunk@2283 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent 4a290d0a
......@@ -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
......
......@@ -33,3 +33,9 @@ class NEOStorageDoesNotExistError(NEOStorageNotFoundError):
"""
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.
"""
......@@ -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.TransactionRecord):
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:
......
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