def testModificationTimeDuringInlineImageMigration(self): foo = self.folder[self.folder.invokeFactory('Image', id='foo')] foo.schema['image'] = ImageField('image', storage=AnnotationStorage()) foo.schema['image'].set(foo, getImage()) # record the modification date before migration mod = foo.modified() # migrate using inline migrator migrate(self.portal, portal_type='Image', meta_type='ATBlob') # the modification date isn't changed by migration self.assertEqual(mod, foo.modified())
def testModificationTimeDuringInlineImageMigration(self): foo = self.folder[self.folder.invokeFactory('Image', id='foo')] foo.schema['image'] = ImageField('image', storage=AnnotationStorage()) foo.schema['image'].set(foo, getImage()) # record the modification date before migration mod = foo.modified() # migrate using inline migrator migrate(self.portal, portal_type='Image', meta_type='ATBlob') # the modification date isn't changed by migration self.assertEqual(mod, foo.modified()) # cleanup del foo.schema['image']
def migrate_issue_attachments_to_blobstorage(context): from plone.app.blob.migrations import migrate logger.info('Migrating to blob attachments for issues. ' 'This can take a long time...') # Technically, the plone.app.blob migration says it is only for non blob # fields that are still in the schema but are overridden using # archetypes.schemaextender with a blob field with the same name. But it # seems to go fine for Issues where we have simply changed the schema # directly. The getters of a BlobFileField and normal FileField don't # differ that much. migrate(context, 'PoiIssue') logger.info("Done migrating to blob attachment for issues.")
def testOldScalesRemovedDuringInlineImageMigration(self): gif = getImage() foo = self.folder[self.folder.invokeFactory('Image', id='foo', title='an image', image=gif)] # fake an old ImageField in the class schema, # and store scales in AnnotationStorage foo.schema['image'] = ImageField('image', storage=AnnotationStorage()) foo.schema['image'].set(foo, gif) isimage = lambda i: isinstance(i, Image) self.failUnless(filter(isimage, IAnnotations(foo).values())) # migrate using inline migrator migrate(self.portal, portal_type='Image', meta_type='ATBlob') # make sure all scale annotations were removed self.failIf(filter(isimage, IAnnotations(foo).values()))
def testOldScalesRemovedDuringInlineImageMigration(self): gif = getImage() foo = self.folder[self.folder.invokeFactory('Image', id='foo', title='an image', image=gif)] # fake an old ImageField in the class schema, # and store scales in AnnotationStorage foo.schema['image'] = ImageField('image', storage=AnnotationStorage()) foo.schema['image'].set(foo, gif) isimage = lambda i: isinstance(i, Image) self.assertTrue(filter(isimage, IAnnotations(foo).values())) # migrate using inline migrator migrate(self.portal, portal_type='Image', meta_type='ATBlob') # make sure all scale annotations were removed self.assertFalse(filter(isimage, IAnnotations(foo).values())) # cleanup del foo.schema['image']
def migrateFtwFiles(context): portal = getToolByName(context, "portal_url").getPortalObject() out = "" try: catalog_class = applyCatalogPatch(portal) out = migrate(context, walker=getFtwFileMigrationWalker) finally: removeCatalogPatch(catalog_class) return out
def migrateImagedEvent(context): if migrate is None: raise RuntimeError('You need plone.app.blob installed') return migrate(context, "Event", meta_type="ATEvent")
def migrations(self): out = '' for walker in self.walkers(): out += migrate(self, walker=lambda x: walker) return out
def migrateMonetEvent(context): if migrate is None: raise RuntimeError('You need plone.app.blob installed') return migrate(context, "Event", meta_type="ATEvent")
def migrateRed5Streams(context): return migrate(context, walker=getRed5StreamsMigrationWalker)
def migrate_to_blob_fields(context): from plone.app.blob.migrations import migrate logger.info("Migrating to blob fields...") migrate(context, 'Project') logger.info("Done migrating to blob fields.")
def migrateLxarquivo(context): return migrate(context, 'Lxarquivo')
def migrateRTInternalVideo(context): from plone.app.blob.migrations import migrate return migrate(context, 'RTInternalVideo')
def migrateChamada(self): return migrate(self, walker=getChamadaMigrationWalker)
def migrateArtista(self): return migrate(self, walker=getArtistaMigrationWalker)
def change_paragraph_image_storage_type_to_blobstorage(context): """Change the storagetype of the imagefield for paragraph""" print migrate(context, 'Paragraph') print migrate(context, 'News') transaction.commit()
def migrateVwBlob(context): return migrate(context, 'VwireLens')
def migrateSuperFile(self): return migrate(self, walker=getSuperFileMigrationWalker)
def migration(self): return migrate(self, walker=ArticleTeaserMigrationView.walker)
def migrateNewsItem(self): return migrate(self, walker=getNewsItemMigrationWalker)