[Erp5-report] r17894 - in /erp5/trunk/products/ERP5Catalog: Tool/ tests/
nobody at svn.erp5.org
nobody at svn.erp5.org
Thu Nov 29 12:07:10 CET 2007
Author: aurel
Date: Thu Nov 29 12:07:10 2007
New Revision: 17894
URL: http://svn.erp5.org?rev=17894&view=rev
Log:
add a method to get the archive used for the current catalog, add a
test for it
Modified:
erp5/trunk/products/ERP5Catalog/Tool/ArchiveTool.py
erp5/trunk/products/ERP5Catalog/tests/testArchive.py
Modified: erp5/trunk/products/ERP5Catalog/Tool/ArchiveTool.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Catalog/Tool/ArchiveTool.py?rev=17894&r1=17893&r2=17894&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Catalog/Tool/ArchiveTool.py (original)
+++ erp5/trunk/products/ERP5Catalog/Tool/ArchiveTool.py Thu Nov 29 12:07:10 2007
@@ -52,6 +52,7 @@
manage_overview = DTMLFile( 'explainArchiveTool', _dtmldir)
+
def getSQLCatalogIdList(self):
"""
Wrapper to CatalogTool method
@@ -71,6 +72,19 @@
return ["%s - %s" %(x.getId(), x.getTitle()) for x in \
self.portal_catalog(portal_type="Archive",
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):
Modified: erp5/trunk/products/ERP5Catalog/tests/testArchive.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Catalog/tests/testArchive.py?rev=17894&r1=17893&r2=17894&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Catalog/tests/testArchive.py (original)
+++ erp5/trunk/products/ERP5Catalog/tests/testArchive.py Thu Nov 29 12:07:10 2007
@@ -351,6 +351,9 @@
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()
More information about the Erp5-report
mailing list