From 644a32d8b5ea902d6462fbd28779cc7edf000cc9 Mon Sep 17 00:00:00 2001
From: Romain Courteaud <romain@nexedi.com>
Date: Wed, 1 Mar 2006 17:32:11 +0000
Subject: [PATCH] Bug fix: catalog variable must exist for the calculation of
 hot_reindexing.

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

diff --git a/product/ZSQLCatalog/ZSQLCatalog.py b/product/ZSQLCatalog/ZSQLCatalog.py
index 9d58c96972..463a3bba03 100755
--- a/product/ZSQLCatalog/ZSQLCatalog.py
+++ b/product/ZSQLCatalog/ZSQLCatalog.py
@@ -593,10 +593,13 @@ class ZCatalog(Folder, Persistent, Implicit):
     """ wrapper around catalog """
     self.catalogObjectList([obj], sql_catalog_id=sql_catalog_id)
 
-  def catalogObjectList(self, object_list, sql_catalog_id=None,**kw):
+  def catalogObjectList(self, object_list, sql_catalog_id=None, **kw):
     """Catalog a list of objects.
     """
-    hot_reindexing = (self.hot_reindexing_state is not None and self.source_sql_catalog_id == catalog.id)
+    catalog = self.getSQLCatalog(sql_catalog_id)
+    hot_reindexing = (self.hot_reindexing_state is not None) and \
+                     (catalog is not None) and \
+                     (self.source_sql_catalog_id == catalog.id)
     
     wrapped_object_list = []
     failed_object_list = []
@@ -611,6 +614,7 @@ class ZCatalog(Folder, Persistent, Implicit):
             "method if no unique id is provided when cataloging"
             )
         url = string.join(url(), '/')
+        url = '/'.join(url())
         url_list.append(url)
 
       try:
@@ -623,7 +627,6 @@ class ZCatalog(Folder, Persistent, Implicit):
       else:
         wrapped_object_list.append(obj)
 
-    catalog = self.getSQLCatalog(sql_catalog_id)
     if catalog is not None:
       catalog.catalogObjectList(wrapped_object_list,**kw)
       if hot_reindexing:
-- 
2.30.9