Zope.app.file File Chunks in 5.1

I generally have very few content types that include a NamedFile field because using file content types is almost always preferred for us. However we do have one type with a 'pdf' NamedFile field using Dexterity. I don't know why they were all stored such that obj.pdf._data was a FileChunk instance from zope.app.file. That package is not in 5.1 by default so these were all broken objects.

I was able to fix this by putting zope.app.file back in my buildout, converting, and taking that package back out. For the conversion I just did obj.pdf = NamedFile(obj.pdf.data, filename=obj.pdf.filename). This resulted in an instance from a class in plone.namedfile instead of zope.app.file.

I'm just posting this as an FYI in case someone else runs into this. I don't know why it's using a FileChunk instance though. the value for obj.pdf.data (not _data) is just a str.

2 Likes

Plone Foundation Code of Conduct