commit-gnue
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gnue] r7995 - trunk/gnue-appserver/src


From: johannes
Subject: [gnue] r7995 - trunk/gnue-appserver/src
Date: Wed, 28 Sep 2005 12:35:46 -0500 (CDT)

Author: johannes
Date: 2005-09-26 03:32:05 -0500 (Mon, 26 Sep 2005)
New Revision: 7995

Modified:
   trunk/gnue-appserver/src/data.py
Log:
Don't throw away initialized but not commitable records


Modified: trunk/gnue-appserver/src/data.py
===================================================================
--- trunk/gnue-appserver/src/data.py    2005-09-25 16:26:32 UTC (rev 7994)
+++ trunk/gnue-appserver/src/data.py    2005-09-26 08:32:05 UTC (rev 7995)
@@ -972,20 +972,23 @@
       # Commit the whole transaction
       self.__backend.commit ()
 
+      if self.__backend._need_rollback_after_exception_:
+        for (table, rows) in tables.items ():
+          for row in rows.keys ():
+            state = self.__cache.state (table, row)
+            if state in ['inserted', 'changed']:
+              self.__cache.makeClean (table, row)
+            elif state == 'deleted':
+              self.__cache.remove (table, row)
+
     except:
       if self.__backend._need_rollback_after_exception_:
         self.__backend.rollback ()
       raise
 
-    # The transaction has ended. Changes from other transactions could become
-    # valid in this moment, so we have to clear the cache.
-    if self.__backend._need_rollback_after_exception_:
-      self.__cache.clear ()
-    else:
-      # FIXME: I'm not sure if it makes sense to clean "only old" data here. In
-      # which cases will there be something left in the "new" cache? I mean, we
-      # just committed all changes, didn't we??  -- Reinhard
-      self.__cache.clear (True)
+    # Clear any old stuff from cache, but keep initialized (and not
+    # commitbable) records in there.
+    self.__cache.clear (True)
 
 
   # ---------------------------------------------------------------------------





reply via email to

[Prev in Thread] Current Thread [Next in Thread]