[Zodb-checkins] CVS: ZODB3/Tools - repozo.py:1.1.2.4

Tim Peters tim.one at comcast.net
Sat Aug 16 20:25:05 EDT 2003


Update of /cvs-repository/ZODB3/Tools
In directory cvs.zope.org:/tmp/cvs-serv10446/Tools

Modified Files:
      Tag: ZODB3-3_1-branch
	repozo.py 
Log Message:
scandat():  The caller clearly believes that (None,)*4 should be returned
if the .dat file is missing or empty.  However, the code actually tries to
do long(None) in either of those cases, and that leads to the traceback
death Jens reported.  Repaired that in the obvious way, but this is
untested!

Also repaired out-of-date and inaccurate comments in scandat().


=== ZODB3/Tools/repozo.py 1.1.2.3 => 1.1.2.4 ===
--- ZODB3/Tools/repozo.py:1.1.2.3	Mon Apr  7 17:54:56 2003
+++ ZODB3/Tools/repozo.py	Sat Aug 16 19:24:59 2003
@@ -296,15 +296,20 @@
         log('no files found')
     return needed
 
+# Scan the .dat file corresponding to the last full backup performed.
+# Return
+#
+#     filename, startpos, endpos, checksum
+#
+# of the last incremental.  If there is no .dat file, or the .dat file
+# is empty, return
+#
+#     None, None, None, None
 
 def scandat(repofiles):
-    # Scan the .dat file corresponding to the last full backup performed.
-    # Return the filename, startpos, endpos, and sum of the last incremental.
-    # If all is a list, then append file name and md5sums to the list.
     fullfile = repofiles[0]
     datfile = os.path.splitext(fullfile)[0] + '.dat'
-    # If the .dat file is missing, we have to do a full backup
-    fn = startpos = endpos = sum = None
+    fn = startpos = endpos = sum = None # assume .dat file missing or empty
     try:
         fp = open(datfile)
     except IOError, e:
@@ -315,11 +320,11 @@
             line = fp.readline()
             if not line:
                 break
-            # We only care about the last one
+            # We only care about the last one.
             fn, startpos, endpos, sum = line.split()
         fp.close()
-    startpos = long(startpos)
-    endpos = long(endpos)
+        startpos = long(startpos)
+        endpos = long(endpos)
     return fn, startpos, endpos, sum
 
 




More information about the Zodb-checkins mailing list