hooks/syncschema.py
branchstable
changeset 5845 4e28f03651d4
parent 5834 b8ad49864928
child 5846 0337e6870de4
--- a/hooks/syncschema.py	Wed Jun 30 18:47:10 2010 +0200
+++ b/hooks/syncschema.py	Thu Jul 01 08:13:03 2010 +0200
@@ -251,12 +251,11 @@
             return
         session = self.session
         if 'fulltext_container' in self.values:
-            ftiupdates = session.transaction_data.setdefault(
-                'fti_update_etypes', set())
             for subjtype, objtype in rschema.rdefs:
-                ftiupdates.add(subjtype)
-                ftiupdates.add(objtype)
-            UpdateFTIndexOp(session)
+                hook.set_operation(self._cw, 'fti_update_etypes', subjtype,
+                                   UpdateFTIndexOp)
+                hook.set_operation(self._cw, 'fti_update_etypes', objtype,
+                                   UpdateFTIndexOp)
         if not 'inlined' in self.values:
             return # nothing to do
         inlined = self.values['inlined']
@@ -523,9 +522,8 @@
                 sql = adbh.sql_set_null_allowed(table, column, coltype, notnull)
             session.system_sql(sql)
         if 'fulltextindexed' in self.values:
-            UpdateFTIndexOp(session)
-            session.transaction_data.setdefault(
-                'fti_update_etypes', set()).add(etype)
+            hook.set_operation(self._cw, 'fti_update_etypes', etype,
+                               UpdateFTIndexOp)
 
 
 class SourceDbCWConstraintAdd(hook.Operation):
@@ -1184,7 +1182,7 @@
     def postcommit_event(self):
         session = self.session
         source = session.repo.system_source
-        to_reindex = session.transaction_data.get('fti_update_etypes', ())
+        to_reindex = session.transaction_data.pop('fti_update_etypes', ())
         self.info('%i etypes need full text indexed reindexation',
                   len(to_reindex))
         schema = self.session.repo.vreg.schema