[Zope-Checkins] CVS: ZODB3/ZODB - DemoStorage.py:1.17

Jeremy Hylton jeremy@zope.com
Mon, 17 Mar 2003 13:24:58 -0500


Update of /cvs-repository/ZODB3/ZODB
In directory cvs.zope.org:/tmp/cvs-serv8219

Modified Files:
	DemoStorage.py 
Log Message:
Fix undoLog() to process arguments correctly.
Fix edge case in pack() -- backpointer to object created in version.


=== ZODB3/ZODB/DemoStorage.py 1.16 => 1.17 ===
--- ZODB3/ZODB/DemoStorage.py:1.16	Mon Mar 17 12:52:13 2003
+++ ZODB3/ZODB/DemoStorage.py	Mon Mar 17 13:24:57 2003
@@ -355,8 +355,8 @@
         finally: self._lock_release()
 
     def undoLog(self, first, last, filter=None):
-        # I think this is wrong given the handling of first and last
-        # in FileStorage.
+        if last < 0:
+            last = first - last + 1
         self._lock_acquire()
         try:
             # XXX Shouldn't this be sorted?
@@ -505,25 +505,27 @@
 
                 if o:
                     if len(o) != len(t):
-                        _data[tid]=1, u, d, e, tuple(o) # Reset data
+                        _data[tid] = 1, u, d, e, tuple(o) # Reset data
                 else:
                     deleted.append(tid)
 
             # Now delete empty transactions
-            for tid in deleted: del _data[tid]
+            for tid in deleted:
+                del _data[tid]
 
             # Now reset previous pointers for "current" records:
             for r in pindex.values():
-                r[2]=None # Previous record
-                if r[3]: # vdata
-                    r[3][1][2]=None
-
-            pindex=None
+                r[2] = None # Previous record
+                if r[3] and r[3][1]: # vdata
+                    # If this record contains version data and
+                    # non-version data, then clear it out.
+                    r[3][1][2] = None
 
             # Finally, rebuild indexes from transaction data:
             self._index, self._vindex = self._build_indexes()
 
-        finally: self._lock_release()
+        finally:
+            self._lock_release()
         self.getSize()
 
     def _splat(self):