diff --git a/product/ERP5Catalog/Tool/ArchiveTool.py b/product/ERP5Catalog/Tool/ArchiveTool.py index de23a9d44bbaaed5b7b507261b33eae70c5f6e22..377077a833dcc82cb30cc84c31632f3cdc947176 100755 --- a/product/ERP5Catalog/Tool/ArchiveTool.py +++ b/product/ERP5Catalog/Tool/ArchiveTool.py @@ -52,6 +52,7 @@ class ArchiveTool(BaseTool): manage_overview = DTMLFile( 'explainArchiveTool', _dtmldir) + def getSQLCatalogIdList(self): """ Wrapper to CatalogTool method @@ -73,6 +74,19 @@ class ArchiveTool(BaseTool): validation_state="ready")] + def getCurrentArchive(self): + """ + Return the archive used for the current catalog + """ + current_catalog = self.portal_catalog.default_sql_catalog_id + current_archive_list = [x.getObject() for x in self.searchFolder(validation_state="validated") \ + if x.getCatalogId() == current_catalog] + if len(current_archive_list) == 0: + return None + else: + return current_archive_list[0] + + def getArchiveList(self): """ Return the list of archive use by catalog diff --git a/product/ERP5Catalog/tests/testArchive.py b/product/ERP5Catalog/tests/testArchive.py index 1818b49be86c16f1cadf4366b8e9fef435b35535..2f469b5e8de02580f6d927dff379bd1d3c3ac44d 100644 --- a/product/ERP5Catalog/tests/testArchive.py +++ b/product/ERP5Catalog/tests/testArchive.py @@ -351,6 +351,9 @@ class TestArchive(InventoryAPITestCase): self.checkRelativeUrlNotInSQLPathList(path_list, connection_id=self.new_connection_id) self.checkRelativeUrlNotInSQLPathList(path_list, connection_id=self.archive_connection_id) + # check the current archive + self.assertEquals(portal_archive.getCurrentArchive(), dest) + def test_suite(): suite = unittest.TestSuite()