def reindex_item_badge(event): """Reindex `item_badge` for all item versions of èvent.object.""" catalogs = find_service(event.object, 'catalogs') children = event.object.values() versionables = (c for c in children if IVersionable.providedBy(c)) for versionable in versionables: catalogs.reindex_index(versionable, 'item_badge')
def reindex_workflow_state(event): """Reindex the workflow_state index for item and its versions.""" catalogs = find_service(event.object, 'catalogs') catalogs.reindex_index(event.object, 'workflow_state') children = event.object.values() versionables = (c for c in children if IVersionable.providedBy(c)) for versionable in versionables: catalogs.reindex_index(versionable, 'workflow_state')
def reindex_decision_date(event): """Reindex the decision_date index for item and its versions.""" catalogs = find_service(event.object, "catalogs") catalogs.reindex_index(event.object, "decision_date") children = event.object.values() versionables = (c for c in children if IVersionable.providedBy(c)) for versionable in versionables: catalogs.reindex_index(versionable, "decision_date")
def _update_version(self, resource: IVersionable): create_sheets = self.content.get_sheets_create(resource, self.request) is_first = get_sheet_field(self.context, ITags, 'FIRST') == resource appstructs = self.request.validated.get('data', {}) for sheet in create_sheets: isheet = sheet.meta.isheet is_version_sheet = IVersionable.isEqualOrExtendedBy(isheet) if is_version_sheet and is_first: continue isheet_name = isheet.__identifier__ if isheet_name in appstructs: # pragma: no branch sheet.set(appstructs[isheet.__identifier__], request=self.request)