Skip to content

CMFCategory: disable raising CategoryError

Using the fallback_category acquisition when a pointed link does not exist can lead to nothing indexed in the category table.

In such case, getAcquiredCategoryList raises a CategoryError, leading to an empty category list in the table, even if the document has other categories.

The attached test fails with:

======================================================================
FAIL: test_notIndexedDocumentBecauseOfBrokenFallbackCategoryAcquisition (erp5.component.test.erp5_version.testIndexationBug.TestIndexationBug)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "<portal_components/test.erp5.testIndexationBug>", line 75, in test_notIndexedDocumentBecauseOfBrokenFallbackCategoryAcquisition
    self._checkDocumentIsIndexed(supply_cell, 1)
  File "<portal_components/test.erp5.testIndexationBug>", line 30, in _checkDocumentIsIndexed
    self.assertTrue(sql_result is not None, 'Category %s is not indexed on %s' % (category_relative_url, document.getRelativeUrl()))
AssertionError: Category resource/product_module/1 is not indexed on sale_supply_module/1/1/1
Edited by Romain Courteaud

Merge request reports