Commit 9acb99e8 authored by Jim Fulton's avatar Jim Fulton

Fixed a bug in the error reporting. Errors were tracked independently

for each transaction.  Now they are tracked globally.
parent 855a2f8c
...@@ -20,6 +20,8 @@ from cStringIO import StringIO ...@@ -20,6 +20,8 @@ from cStringIO import StringIO
from ZODB.FileStorage import FileStorage from ZODB.FileStorage import FileStorage
from ZODB.zodb4 import z4iterator from ZODB.zodb4 import z4iterator
errors = {}
skipped = 0
class Conversion: class Conversion:
...@@ -33,6 +35,9 @@ class Conversion: ...@@ -33,6 +35,9 @@ class Conversion:
self.outstore.copyTransactionsFrom(self.instore) self.outstore.copyTransactionsFrom(self.instore)
self.outstore.close() self.outstore.close()
self.instore.close() self.instore.close()
if errors:
sys.stderr.write(error_explanation)
sys.stderr.write("%s database records skipped\n" % skipped)
class IterableFileIterator(z4iterator.FileIterator): class IterableFileIterator(z4iterator.FileIterator):
...@@ -57,8 +62,7 @@ class DataRecordConvertingTxn(object): ...@@ -57,8 +62,7 @@ class DataRecordConvertingTxn(object):
return getattr(self._txn, name) return getattr(self._txn, name)
def __iter__(self): def __iter__(self):
errors = {} global skipped
skipped = 0
for record in self._txn: for record in self._txn:
record.tid = record.serial record.tid = record.serial
# transform the data record format # transform the data record format
...@@ -88,9 +92,6 @@ class DataRecordConvertingTxn(object): ...@@ -88,9 +92,6 @@ class DataRecordConvertingTxn(object):
record.data = sio.getvalue() record.data = sio.getvalue()
yield record yield record
if errors:
sys.stderr.write(error_explanation)
sys.stderr.write("%s database records skipped\n" % skipped)
error_explanation = """ error_explanation = """
There were import errors while copying data records. There were import errors while copying data records.
......
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