[Erp5-report] r17584 - /erp5/trunk/products/ZSQLCatalog/ZSQLCatalog.py

nobody at svn.erp5.org nobody at svn.erp5.org
Wed Nov 14 16:03:10 CET 2007


Author: aurel
Date: Wed Nov 14 16:03:10 2007
New Revision: 17584

URL: http://svn.erp5.org?rev=17584&view=rev
Log:
when uncataloging object, do not launch activity for each catalog,
instead remove in current catalog and launch for others

Modified:
    erp5/trunk/products/ZSQLCatalog/ZSQLCatalog.py

Modified: erp5/trunk/products/ZSQLCatalog/ZSQLCatalog.py
URL: http://svn.erp5.org/erp5/trunk/products/ZSQLCatalog/ZSQLCatalog.py?rev=17584&r1=17583&r2=17584&view=diff
==============================================================================
--- erp5/trunk/products/ZSQLCatalog/ZSQLCatalog.py (original)
+++ erp5/trunk/products/ZSQLCatalog/ZSQLCatalog.py Wed Nov 14 16:03:10 2007
@@ -831,25 +831,29 @@
     """ wrapper around catalog """
     if uid is None:
       raise TypeError, "sorry uncatalog_object supports only uid"
-
-    archive_list = []
-    if getattr(self, "portal_archives", None) is not None:
-      if len(self.portal_archives):
-        archive_list = self.portal_archives.getArchiveList()
-
-    catalog_id = None
-    if len(archive_list) and sql_catalog_id is None:
-      for archive_path in archive_list:
-        try:
-          archive = self.unrestrictedTraverse(archive_path)
-        except KeyError:
-          continue
-        catalog_id = archive.getCatalogId()
-        self.activate(activity="SQLQueue", round_robin_scheduling=1,
-                      priority=archive.getPriority()).uncatalog_object(uid=uid,path=path,
-                                                                      sql_catalog_id=catalog_id)
-    catalog = self.getSQLCatalog(sql_catalog_id)
-    if catalog is not None and catalog_id is None:
+    default_catalog = self.getSQLCatalog()
+
+    if sql_catalog_id is None:
+      archive_list = []
+      if getattr(self, "portal_archives", None) is not None:
+        if len(self.portal_archives):
+          archive_list = self.portal_archives.getArchiveList()
+
+      if len(archive_list):
+        for archive_path in archive_list:
+          try:
+            archive = self.unrestrictedTraverse(archive_path)
+          except KeyError:
+            continue
+          catalog_id = archive.getCatalogId()
+          if catalog_id != default_catalog.id:
+            # only launch activity when not in current catalog
+            self.activate(activity="SQLQueue", round_robin_scheduling=1,
+                          priority=archive.getPriority()).uncatalog_object(uid=uid,path=path,
+                                                                           sql_catalog_id=catalog_id)
+          
+    catalog = self.getSQLCatalog(sql_catalog_id)
+    if catalog is not None:
       catalog.uncatalogObject(uid=uid,path=path)
       if self.hot_reindexing_state is not None and self.source_sql_catalog_id == catalog.id:
         destination_catalog = self.getSQLCatalog(self.destination_sql_catalog_id)




More information about the Erp5-report mailing list