Commit 5e45f3ef authored by Vincent Pelletier's avatar Vincent Pelletier

The value returned by store can be of multiple types.

If the value evaluates to False, don't update preindex.
If the value is a string, update preindex entry for given oid.
Otherwise, iterate over it, it must contain (oid, serial) tuples.

git-svn-id: https://svn.erp5.org/repos/neo/trunk@1755 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent ea0b22f3
......@@ -20,6 +20,14 @@ def runImport(neo, datafs):
t = int(time())
d.setdefault(t, 0)
d[t] += 1
def updateLastSerial(oid, result):
if result:
if isinstance(result, str):
preindex[oid] = result
else:
for oid, serial in result:
assert isinstance(serial, str), serial
preindex[oid] = serial
txn = {}
obj = {}
preindex = {}
......@@ -31,7 +39,7 @@ def runImport(neo, datafs):
inc(obj)
pre = preindex.get(r.oid, None)
s = self.store(r.oid, pre, r.data, r.version, transaction)
preindex[r.oid] = s
updateLastSerial(r.oid, s)
self.tpc_vote(transaction)
self.tpc_finish(transaction)
fiter.close()
......
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