[Zope3-checkins] CVS: Zope3/src/ZODB/zodb4 - conversion.py:1.4

Jim Fulton jim at zope.com
Mon Feb 23 06:54:45 EST 2004


Update of /cvs-repository/Zope3/src/ZODB/zodb4
In directory cvs.zope.org:/tmp/cvs-serv30765/src/ZODB/zodb4

Modified Files:
	conversion.py 
Log Message:
Fixed a bug in the error reporting. Errors were tracked independently
for each transaction.  Now they are tracked globally.


=== Zope3/src/ZODB/zodb4/conversion.py 1.3 => 1.4 ===
--- Zope3/src/ZODB/zodb4/conversion.py:1.3	Fri Feb 20 15:47:59 2004
+++ Zope3/src/ZODB/zodb4/conversion.py	Mon Feb 23 06:54:44 2004
@@ -20,6 +20,8 @@
 from ZODB.FileStorage import FileStorage
 from ZODB.zodb4 import z4iterator
 
+errors = {}
+skipped = 0
 
 class Conversion:
 
@@ -33,6 +35,9 @@
         self.outstore.copyTransactionsFrom(self.instore)
         self.outstore.close()
         self.instore.close()
+        if errors:
+            sys.stderr.write(error_explanation)
+            sys.stderr.write("%s database records skipped\n" % skipped)
 
 
 class IterableFileIterator(z4iterator.FileIterator):
@@ -57,8 +62,7 @@
         return getattr(self._txn, name)
 
     def __iter__(self):
-        errors = {}
-        skipped = 0
+        global skipped
         for record in self._txn:
             record.tid = record.serial
             # transform the data record format
@@ -88,9 +92,6 @@
             record.data = sio.getvalue()
             yield record
 
-        if errors:
-            sys.stderr.write(error_explanation)
-            sys.stderr.write("%s database records skipped\n" % skipped)
 
 error_explanation = """
 There were import errors while copying data records.




More information about the Zope3-Checkins mailing list