From d1e824b6fc5e10c0ca2a017fddf053d4b2b46c77 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Aur=C3=A9lien=20Calonne?= <aurel@nexedi.com>
Date: Fri, 2 Nov 2007 13:40:21 +0000
Subject: [PATCH] same optimisation as previous one but for uncatalog

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

diff --git a/product/ZSQLCatalog/ZSQLCatalog.py b/product/ZSQLCatalog/ZSQLCatalog.py
index a459bddb3d..a134746fe2 100644
--- a/product/ZSQLCatalog/ZSQLCatalog.py
+++ b/product/ZSQLCatalog/ZSQLCatalog.py
@@ -823,10 +823,11 @@ class ZCatalog(Folder, Persistent, Implicit):
     if uid is None:
       raise TypeError, "sorry uncatalog_object supports only uid"
 
+    archive_list = []
     if getattr(self, "portal_archives", None) is not None:
-      archive_list = self.portal_archives.getArchiveList()
-    else:
-      archive_list = []
+      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:
-- 
2.30.9