From 54faaf9d2b9563ad0e1d95236e36f04de05c9f38 Mon Sep 17 00:00:00 2001
From: Yoshinori Okuji <yo@nexedi.com>
Date: Mon, 17 Jan 2005 14:39:11 +0000
Subject: [PATCH] Add a workaround for SQLDict.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@2221 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 product/ZSQLCatalog/ZSQLCatalog.py | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/product/ZSQLCatalog/ZSQLCatalog.py b/product/ZSQLCatalog/ZSQLCatalog.py
index 66fb73d72d..5ce26866f7 100755
--- a/product/ZSQLCatalog/ZSQLCatalog.py
+++ b/product/ZSQLCatalog/ZSQLCatalog.py
@@ -262,6 +262,12 @@ class ZCatalog(Folder, Persistent, Implicit):
     # This change must be reflected as soon as possible.
     get_transaction().commit()
 
+  def finishHotReindexing(self, **kw):
+    """
+      XXX: This is a workaround for CMFActivity.
+    """
+    self.setHotReindexingState(state='finished', **kw)
+
   def playBackRecordedObjectList(self, sql_catalog_id=None):
     """
       Play back must be a distinct method to activate...
@@ -390,8 +396,6 @@ class ZCatalog(Folder, Persistent, Implicit):
       # XXX Commit transactions very often and use resolve_path to get objects instead of objectValues
       # XXX This is not to be disturbed by normal user operations in the foreground.
       # XXX Otherwise, many read conflicts happen and hot reindexing restarts again and again.
-      LOG('hotReindex, skin_core.objectIds',0,self.portal_skins.erp5_core.objectIds())
-      LOG('hotReindex, skin_core.__dict__',0,self.portal_skins.__dict__)
       #for path in self.Catalog_getIndexablePathList():
       for path in self.portal_skins.erp5_core.Catalog_getIndexablePathList():
         object = self.resolve_path(path)
@@ -431,11 +435,11 @@ class ZCatalog(Folder, Persistent, Implicit):
 
       # Exchange the databases.
       LOG('hotReindexObjectList', 0, 'Exchanging databases')
-      self.activate(after_method_id=('reindexObject', 'playBackRecordedObjectList')).exchangeDatabases(source_sql_catalog_id, destination_sql_catalog_id, skin_selection_dict, sql_connection_id_dict) # XXX Never called by activity tool, why ??? XXX
+      self.activate(after_method_id=('reindexObject', 'playBackRecordedObjectList', 'setHotReindexingState'), priority=5).exchangeDatabases(source_sql_catalog_id, destination_sql_catalog_id, skin_selection_dict, sql_connection_id_dict) # XXX Never called by activity tool, why ??? XXX
     finally:
       # Finish.
       LOG('hotReindexObjectList', 0, 'Finishing hot reindexing')
-      self.activate(passive_commit=1, after_method_id='exchangeDatabases', priority=5).setHotReindexingState('finished')
+      self.activate(passive_commit=1, after_method_id='exchangeDatabases', priority=5).finishHotReindexing()
 
     if RESPONSE is not None:
       URL1 = REQUEST.get('URL1')
-- 
2.30.9