From 780e0b02dd1674d5d31626f030e8b9c18039b063 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien=20Calonne?= <aurel@nexedi.com> Date: Thu, 29 Nov 2007 11:08:06 +0000 Subject: [PATCH] use getCurrentArchive to know which one must be cancelled at end of archiving git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@17895 20353a03-c40f-0410-a6d1-a30d3c3de9de --- product/ZSQLCatalog/ZSQLCatalog.py | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/product/ZSQLCatalog/ZSQLCatalog.py b/product/ZSQLCatalog/ZSQLCatalog.py index 3dae0f18ce..3a454402d1 100644 --- a/product/ZSQLCatalog/ZSQLCatalog.py +++ b/product/ZSQLCatalog/ZSQLCatalog.py @@ -283,22 +283,19 @@ class ZCatalog(Folder, Persistent, Implicit): """ Exchange databases and finish reindexing in the same transaction. """ + if self.archive_path is not None and \ + getattr(self, "portal_archives", None) is not None: + current_archive = self.portal_archives.getCurrentArchive() + else: + current_archive = None default_catalog_id = self.default_sql_catalog_id self.exchangeDatabases(source_sql_catalog_id=source_sql_catalog_id, destination_sql_catalog_id=destination_sql_catalog_id, skin_selection_dict=skin_selection_dict, sql_connection_id_dict=sql_connection_id_dict) - # cancel archive use as current catalog before archive - if self.archive_path is not None and \ - getattr(self, "portal_archives", None) is not None: - if len(self.portal_archives): - archive_list = self.portal_archives.getArchiveList() - for archive_path in archive_list: - archive = self.unrestrictedTraverse(archive_path) - if archive.getCatalogId() == default_catalog_id: - # this is the current catalog used for archiving - archive.cancel() - + # cancel archive use as current catalog before archiving + if current_archive is not None: + current_archive.cancel() self.setHotReindexingState(state=HOT_REINDEXING_FINISHED_STATE) clearCache(cache_factory_list=('erp5_content_short',)) -- 2.30.9