def test_selectable_fields_index(self): new_type = self.new_temporary_type( behaviors=[IPerson.__identifier__], model_source=self.selectable_xml, klass='seantis.people.types.base.PersonBase' ) schema = new_type.lookupSchema() catalog = api.portal.get_tool(catalog_id) ix = '{}_selectable_{}' self.assertIn(ix.format(new_type.id, 'first'), catalog.indexes()) self.assertIn(ix.format(new_type.id, 'second'), catalog.indexes()) self.assertIn(ix.format(new_type.id, 'third'), catalog.indexes()) # nothing changes implicitly set_selectable_fields(schema, ['third']) self.assertIn(ix.format(new_type.id, 'first'), catalog.indexes()) self.assertIn(ix.format(new_type.id, 'second'), catalog.indexes()) self.assertIn(ix.format(new_type.id, 'third'), catalog.indexes()) # the index must be rebuilt by hand (using the web-interface events # will take care of that) update_related_indexes(new_type) self.assertNotIn(ix.format(new_type.id, 'first'), catalog.indexes()) self.assertNotIn(ix.format(new_type.id, 'second'), catalog.indexes()) self.assertIn(ix.format(new_type.id, 'third'), catalog.indexes())
def upgrade_portal_type(portal_type, module, profile): run_import_step_from_profile('typeinfo', module, profile) update_related_indexes(getUtility(IDexterityFTI, portal_type))
def upgrade_portal_type(portal_type, module, profile): run_import_step_from_profile('typeinfo', module, profile) update_related_indexes(getUtility(IDexterityFTI, portal_type))