diff --git a/Products/zms/ZMSZCatalogAdapter.py b/Products/zms/ZMSZCatalogAdapter.py index 921eb5660..c326c3c18 100644 --- a/Products/zms/ZMSZCatalogAdapter.py +++ b/Products/zms/ZMSZCatalogAdapter.py @@ -169,7 +169,6 @@ def traverse(node, recursive): # ZMSZCatalogAdapter.reindex_node # -------------------------------------------------------------------------- def reindex_node(self, node): - standard.writeBlock(node, "[reindex_node]") connectors = [] fileparsing = False try: @@ -183,28 +182,31 @@ def reindex_node(self, node): container_nodes = standard.difference_list(breadcrumbs, page_nodes) container_nodes.append(container_page) filtered_container_nodes = [e for e in container_nodes if self.matches_ids_filter(e)] + # Hint: getCatalogAdapter prefers local adapter, otherwise root adapter. + connectors = node.getCatalogAdapter().get_connectors() if filtered_container_nodes: - # Hint: getCatalogAdapter prefers local adapter, otherwise root adapter. fileparsing = standard.pybool(node.getConfProperty('ZMS.CatalogAwareness.fileparsing', 1)) - connectors = node.getCatalogAdapter().get_connectors() # Reindex filtered container node's content by each connector. for connector in connectors: for filtered_container_node in filtered_container_nodes: self.reindex(connector, filtered_container_node, recursive=False, fileparsing=fileparsing) + else: + # Remove from catalog if editing leads to filter-not-matching. + for connector in connectors: + connector.manage_objects_remove([container_page]) return True except: standard.writeError( self, "can't reindex_node") return False # -------------------------------------------------------------------------- - # ZMSZCatalogAdapter.unindex_node + # ZMSZCatalogAdapter.unindex_nodes # -------------------------------------------------------------------------- def unindex_nodes(self, nodes=[], forced=False): # Is triggered by zmscontainerobject.moveObjsToTrashcan(). # Todo: ensure param 'nodes' does contain all ids to be indexed # to avoid sequentially unindexing leading to redundant reindexing # on the same page-node. - standard.writeBlock(self, "[unindex_nodes]") try: if self.getConfProperty('ZMS.CatalogAwareness.active', 1) or forced: # [1] Reindex page-container nodes of deleted page-elements. @@ -221,11 +223,12 @@ def unindex_nodes(self, nodes=[], forced=False): self.reindex_node(node=page_node) # [2] Unindex deleted nodes (from trashcan) if filter-match. delnodes = [delnode for delnode in nodes[0].getParentNode().getTrashcan().objectValues() if ( ( delnode in nodes) and self.matches_ids_filter(delnode) )] - for connector in self.getCatalogAdapter().get_connectors(): + connectors = self.getCatalogAdapter().get_connectors() + for connector in connectors: connector.manage_objects_remove(delnodes) return True except: - standard.writeError( self, "unindex_nodes not successful") + standard.writeError( self, "can't unindex_nodes") return False # -------------------------------------------------------------------------- @@ -255,7 +258,7 @@ def setIds(self, ids): # getter and setter for custom filter-function # -------------------------------------------------------------------------- def getCustomFilterFunction(self): - return getattr(self, '_custom_filter_function', '##\nreturn context.meta_id in meta_ids') + return getattr(self, '_custom_filter_function', '##\nreturn context.meta_id in meta_ids\\\n and (context.isVisible(context.REQUEST))') def setCustomFilterFunction(self, custom_filter_function): setattr(self, '_custom_filter_function', custom_filter_function) @@ -432,4 +435,3 @@ def manage_changeProperties(self, btn, lang, REQUEST, RESPONSE): return RESPONSE.redirect('manage_main?lang=%s&manage_tabs_message=%s#%s'%(lang, message, REQUEST.get('tab'))) ################################################################################ -