collective / collective.lazysizes

Integration of lazysizes, a lightweight lazy loader, into Plone.
https://pypi.org/project/collective.lazysizes
6 stars 2 forks source link

Something odd with the bundle registration? AttributeError: 'dict' object has no attribute '__identifier__' #84

Open agitator opened 3 years ago

agitator commented 3 years ago

I already came accross this problem on Plone 5.2 and didn't use it in production then. Now testing out the deployment on Plone 6 and get this error again when I run the migration steps for plone.staticresources.

lazysizes isn't even installed, just added to the setup.py of my integration package.... Any idea what could be the issue?

2020-09-26 16:53:38,061 INFO    [Products.GenericSetup.tool:1392][waitress-3] Importing profile profile-plone.staticresources.upgrades:10 with dependency strategy ignore.
2020-09-26 16:53:38,062 INFO    [Products.GenericSetup.tool:1431][waitress-3] Applying main profile profile-plone.staticresources.upgrades:10
2020-09-26 16:53:40,190 ERROR   [Zope.SiteErrorLog:18][waitress-3] 1601132020.1896840.21956013297271104 http://localhost:13200/Plone/portal_setup/manage_doUpgrades
Traceback (innermost last):
  Module ZPublisher.WSGIPublisher, line 167, in transaction_pubevents
  Module ZPublisher.WSGIPublisher, line 364, in publish_module
  Module ZPublisher.WSGIPublisher, line 267, in publish
  Module ZPublisher.mapply, line 85, in mapply
  Module Products.PDBDebugMode.wsgi_runcall, line 60, in pdb_runcall
  Module Products.GenericSetup.tool, line 1096, in manage_doUpgrades
  Module Products.GenericSetup.upgrade, line 203, in doStep
  Module Products.GenericSetup.tool, line 399, in runAllImportStepsFromProfile
   - __traceback_info__: profile-plone.staticresources.upgrades:10
  Module Products.GenericSetup.tool, line 1473, in _runImportStepsFromContext
  Module Products.GenericSetup.tool, line 1285, in _doRunImportStep
   - __traceback_info__: plone.app.registry
  Module plone.app.registry.exportimport.handler, line 79, in importRegistry
   - __traceback_info__: registry.xml
  Module plone.app.registry.exportimport.handler, line 127, in importDocument
  Module plone.app.registry.exportimport.handler, line 408, in importRecords
   - __traceback_info__: records name: Products.CMFPlone.interfaces.IBundleRegistry
AttributeError: 'dict' object has no attribute '__identifier__'
hvelarde commented 3 years ago

very weird; you'll have to dig deeper: collective.lazysizes don't register its resources in Plone.

petschki commented 2 weeks ago

I've digged into this. Turns out, that the v10 upgrade step isn't compatible with Plone 6. See https://community.plone.org/t/solved-error-while-installing-collective-z3cform-datagridfield/19801/11

I'll prepare a PR

petschki commented 2 weeks ago

A bit more info:

https://github.com/collective/collective.lazysizes/blob/master/src/collective/lazysizes/upgrades/v10/__init__.py#L7

This overrides the zope.deferredimport marked interface and breaks all Products.CMFPlone.interfaces.IBundleRegistry imports.

If you change those imports to plone.base.interfaces.resources.IBundleRegistry it fixes the error above also, but there are several other places which still import from the old module.