Commit 0db5b119 authored by Aurel's avatar Aurel

fix indentation and redefined all needed methods by ZODB which don't

follow the BaseStorage behaviour


git-svn-id: https://svn.erp5.org/repos/neo/branches/prototype3@51 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent f117cdaa
...@@ -67,18 +67,25 @@ class NEOStorage(BaseStorage.BaseStorage, ...@@ -67,18 +67,25 @@ class NEOStorage(BaseStorage.BaseStorage,
try: try:
self.app.store(oid, serial, data, version, transaction) self.app.store(oid, serial, data, version, transaction)
except NEOStorageConflictError: except NEOStorageConflictError:
new_data = self.app.tryToResolveConflict(oid, self.app.tid, serial, data) new_data = self.app.tryToResolveConflict(oid, self.app.tid,
serial, data)
if new_data is not None: if new_data is not None:
# try again after conflict resolution # try again after conflict resolution
self.store(oid, serial, new_data, version, transaction) self.store(oid, serial, new_data, version, transaction)
else: else:
raise POSException.ConflictError(oid=oid, raise POSException.ConflictError(oid=oid,
serials=(self.app.tid, serial), data=data) serials=(self.app.tid,
serial),data=data)
def _clear_temp(self): def _clear_temp(self):
self.app._clear_temp() self.app._clear_temp()
def getSerial(self, oid):
try:
self.app.getSerial(oid)
except NEOStorageNotFoundError:
raise POSException.POSKeyError (oid)
# mutliple revisions # mutliple revisions
def loadSerial(self, oid, serial): def loadSerial(self, oid, serial):
try: try:
...@@ -93,7 +100,7 @@ class NEOStorage(BaseStorage.BaseStorage, ...@@ -93,7 +100,7 @@ class NEOStorage(BaseStorage.BaseStorage,
raise POSException.POSKeyError (oid, tid) raise POSException.POSKeyError (oid, tid)
def iterator(self, start=None, stop=None): def iterator(self, start=None, stop=None):
self.app.iterator(start, stop) raise NotImplementedError
# undo # undo
def undo(self, transaction_id, txn): def undo(self, transaction_id, txn):
...@@ -102,7 +109,6 @@ class NEOStorage(BaseStorage.BaseStorage, ...@@ -102,7 +109,6 @@ class NEOStorage(BaseStorage.BaseStorage,
self.app.undo(transaction_id, txn) self.app.undo(transaction_id, txn)
def undoInfo(self, first=0, last=-20, specification=None): def undoInfo(self, first=0, last=-20, specification=None):
# XXX is it needed ?
if self._is_read_only: if self._is_read_only:
raise POSException.ReadOnlyError() raise POSException.ReadOnlyError()
self.app.undoInfo(first, last, specification) self.app.undoInfo(first, last, specification)
...@@ -110,7 +116,26 @@ class NEOStorage(BaseStorage.BaseStorage, ...@@ -110,7 +116,26 @@ class NEOStorage(BaseStorage.BaseStorage,
def undoLog(self, first, last, filter): def undoLog(self, first, last, filter):
if self._is_read_only: if self._is_read_only:
raise POSException.ReadOnlyError() raise POSException.ReadOnlyError()
self.app.undoLog(first, last, filter) # This should not be used by ZODB
# instead it should use undoInfo
# Look at ZODB/interface.py for more info
if filter is not None:
return []
else:
return self.undoInfo(first, last)
def supportsUndo(self):
return 0
def abortVersion(self, src, transaction):
return '', []
def commitVersion(self, src, dest, transaction):
return '', []
def set_max_oid(self, possible_new_max_oid):
# seems to be only use by FileStorage
raise NotImplementedError
def copyTransactionsFrom(self, other, verbose=0):
raise NotImplementedError
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