on precommit / rollback of schema update op, clear order_relations cache of entity schemas
--- a/server/schemahooks.py Wed Oct 21 15:12:29 2009 +0200
+++ b/server/schemahooks.py Wed Oct 21 15:13:07 2009 +0200
@@ -16,6 +16,7 @@
from yams.buildobjs import EntityType, RelationType, RelationDefinition
from yams.schema2sql import eschema2sql, rschema2sql, type_from_constraints
+from logilab.common.decorators import clear_cache
from cubicweb import ValidationError, RepositoryError
from cubicweb.schema import META_RTYPES, VIRTUAL_RTYPES, CONSTRAINTS
@@ -134,10 +135,18 @@
self.repo = session.repo
SingleLastOperation.__init__(self, session)
+ def precommit_event(self):
+ for eschema in self.repo.schema.entities():
+ if not eschema.final:
+ clear_cache(eschema, 'ordered_relations')
+
def commit_event(self):
rebuildinfered = self.session.data.get('rebuild-infered', True)
self.repo.set_schema(self.repo.schema, rebuildinfered=rebuildinfered)
+ def rollback_event(self):
+ self.precommit_event()
+
class MemSchemaOperation(Operation):
"""base class for schema operations"""