Skip to content

Commit

Permalink
Update migrations.py
Browse files Browse the repository at this point in the history
Use obj.Schema() instead of obj.schema or some fields (like the ones provided by archetypes.schemaextender) are not taken into account...
  • Loading branch information
gbastien committed Mar 20, 2013
1 parent baf0ad5 commit f57656e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/plone/app/blob/migrations.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def fields_map(self):
def migrate_data(self):
fields = self.getFields(self.obj)
for name in fields:
oldfield = self.obj.schema[name]
oldfield = self.obj.Schema()[name]
if hasattr(oldfield, 'removeScales'):
# clean up old image scales
oldfield.removeScales(self.obj)
Expand Down

3 comments on commit f57656e

@frisi
Copy link
Contributor

@frisi frisi commented on f57656e Nov 25, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this change unfortunately breaks the pattern that is suggested by the doucmentation to migrate existing image and file-fields to blobstorage.

the documentation suggests to add a schemaextender that uses a blob-field and this migrator is meant to access the old field.
see https://plone.org/documentation/manual/upgrade-guide/version/upgrading-plone-3-x-to-4.0/updating-add-on-products-for-plone-4.0/use-plone.app.blob-based-blob-storage

with this change, the migrator copies empty blob files.

@gbastien i think this change should be reverted.

people that need to migrate fields defined via schemaextender to blobstorage need to write their own migration anyway since this plone.app.blob.migrations.migrate won't do the trick in this case anyway

@gbastien
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @frisi

ok, if it is relevant regarding the documentation, then you can revert the change so it fits.

Maybe commenting the line and adding a relevant comment could be usefull? Or maybe it is possible to avoid to copy empty blob files by adding some check?

@frisi
Copy link
Contributor

@frisi frisi commented on f57656e Nov 25, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for your reply @gbastien - i created a pull request #15

Please sign in to comment.