def consume(self, objects): """Consume all objects left""" for obj in objects: if IContentPage.providedBy(obj): self.objects.append(obj) else: yield obj
def migrate_paragraphs(self): try: from simplelayout.types.common.interfaces import IParagraph except ImportError: raise result = self.catalog_unrestricted_search( {'portal_type': 'Paragraph'}, full_objects=True) result = list(result) with ProgressLogger('Migrate Paragraphs', result) as step: for obj in result: if not IContentPage.providedBy(aq_parent(obj)): continue self.migrate_class(obj, TextBlock) obj.portal_type = 'TextBlock' noLongerProvides(obj, IParagraph) alsoProvides(obj, ITextBlock) obj.reindexObject() step()