Title: [commits] (vajda) [11162] - fixed bug, subkind caches need to be flushed before instances are loaded
Revision
11162
Author
vajda
Date
2006-07-14 03:56:45 -0700 (Fri, 14 Jul 2006)

Log Message

- fixed bug, subkind caches need to be flushed before instances are loaded

Modified Paths

Diff

Modified: trunk/chandler/repository/persistence/DBRepositoryView.py (11161 => 11162)

--- trunk/chandler/repository/persistence/DBRepositoryView.py	2006-07-14 03:09:16 UTC (rev 11161)
+++ trunk/chandler/repository/persistence/DBRepositoryView.py	2006-07-14 10:56:45 UTC (rev 11162)
@@ -233,13 +233,6 @@
                 kind.extent._collectionChanged('refresh', 'collection',
                                                'extent', uItem)
 
-                if status & CItem.SCHEMA and kind.isKindOf(kind.getKindKind()):
-                    names = dirtyNames()
-                    if 'attributes' in names:
-                        self[uItem].flushCaches('attributes')
-                    elif 'superKinds' in names:
-                        self[uItem].flushCaches('superKinds')
-
                 dispatch = self.findValue(uItem, 'watcherDispatch', None, version)
                 if dispatch:
                     isNew = (status & CItem.NEW) != 0
@@ -387,14 +380,15 @@
     def _refreshForwards(self, mergeFn, newVersion, notify):
 
         history = []
+        schema_history = []
         refreshes = set()
         deletes = set()
         merges = {}
         unloads = {}
         dangling = []
 
-        self._scanHistory(self.itsVersion, newVersion,
-                          history, refreshes, merges, unloads, deletes)
+        self._scanHistory(self.itsVersion, newVersion, history, schema_history,
+                          refreshes, merges, unloads, deletes)
         oldVersion = self._version
         self._version = newVersion
 
@@ -486,6 +480,17 @@
                         self._status |= CView.VERIFY
                     self.playChangeNotifications()
 
+            # flush schema caches of changed kinds
+            for (uItem, version, uKind, status, uParent,
+                 pKind, dirties) in schema_history:
+                kind = self.find(uKind)
+                if kind.isKindOf(kind.getKindKind()):
+                    names = kind._nameTuple(dirties)
+                    if 'attributes' in names:
+                        self[uItem].flushCaches('attributes')
+                    elif 'superKinds' in names:
+                        self[uItem].flushCaches('superKinds')
+
             if notify:
                 before = time()
                 self._dispatchHistory(history, refreshes,
@@ -677,7 +682,8 @@
             yield uItem, version, kind, status, values, references, prevKind
 
     def _scanHistory(self, oldVersion, toVersion,
-                     history, refreshes, merges, unloads, deletes):
+                     history, schema_history,
+                     refreshes, merges, unloads, deletes):
 
         for args in self.store._items.iterHistory(self, oldVersion, toVersion):
             uItem, version, uKind, status, uParent, prevKind, dirties = args
@@ -687,6 +693,8 @@
 
             if status & CItem.DELETED:
                 deletes.add(uItem)
+            elif status & CItem.SCHEMA:
+                schema_history.append(args)
 
             item = self.find(uItem, False)
             if item is not None:




_______________________________________________
Commits mailing list
[email protected]
http://lists.osafoundation.org/mailman/listinfo/commits

Reply via email to