Objects can no longer adapt to IPrimaryFieldInfo

I have three custom cover tiles, and the client has no budget for upgrading, so I found a solution here:

So I fixed it by doing this in one of my __init__.py files:

from plone.app.contenttypes.behaviors.leadimage import ILeadImage
from zope.interface import alsoProvides
from plone.rfc822.interfaces import IPrimaryField

alsoProvides(ILeadImage['image'], IPrimaryField)

Not sure if this could be done in zcml. By the way, the link to plone.rfc822 above also explains how a field is marked as primary in schema, using marshal:primary="true". That's how the File and Image schemas do it in their schema in plone.app.contenttypes.

I'd still love to understand why this broke at some point on my client's site, but I may never know.

1 Like