Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AutoExtensibleSubformAdapter breaks the schema editor settings popup for certain fields #114

Open
batlock666 opened this issue Aug 10, 2021 · 1 comment
Labels

Comments

@batlock666
Copy link

I have the following packages installed:

Products.CMFPlone = 5.2.5
z3c.form = 3.7.1
collective.z3cform.datagridfield = 1.5.3

When I add a field of certain types in the schema editor (either for a Dexterity content type, or an EasyForm form) and click settings, I get an alert that says "There was an error loading modal.". In the console, I get the following exception:

Traceback (innermost last):
  Module ZPublisher.WSGIPublisher, line 162, in transaction_pubevents
  Module ZPublisher.WSGIPublisher, line 371, in publish_module
  Module ZPublisher.WSGIPublisher, line 274, in publish
  Module ZPublisher.mapply, line 85, in mapply
  Module ZPublisher.WSGIPublisher, line 63, in call_object
  Module plone.z3cform.layout, line 63, in __call__
  Module plone.z3cform.layout, line 47, in update
  Module plone.z3cform.fieldsets.extensible, line 65, in update
  Module plone.z3cform.patch, line 30, in GroupForm_update
  Module z3c.form.group, line 132, in update
  Module z3c.form.form, line 136, in updateWidgets
  Module z3c.form.field, line 277, in update
  Module z3c.form.browser.widget, line 171, in update
  Module z3c.form.object, line 216, in update
  Module Products.CMFPlone.patches.z3c_form, line 47, in _wrapped
  Module z3c.form.widget, line 132, in update
  Module z3c.form.object, line 273, in value
  Module z3c.form.object, line 203, in updateWidgets
  Module z3c.form.object, line 199, in _getForm
  Module zope.component._api, line 102, in getMultiAdapter
  Module zope.component._api, line 116, in queryMultiAdapter
  Module zope.interface.registry, line 365, in queryMultiAdapter
  Module zope.interface.adapter, line 844, in queryMultiAdapter
TypeError: object() takes no parameters

This is caused by the adapter AutoExtensibleSubformAdapter in module autoform. This adapter directly subclasses object, and doesn't define a custom __init__ method. Method _getForm in class z3c.form.object.ObjectWidget tries to create the adapter and the above exception gets thrown. This happens with fields of the following types:

  • Image
  • Rich Text
  • File Upload

I have tried updating collective.z3cform.datagridfield to version 2.0.1, but I still get the same exception.

As far as I can see, this adapter doesn't do anything and should never be created. When we remove the ZCML registration of this adapter, everything works correctly.

See also:

@petschki
Copy link
Member

petschki commented Aug 8, 2022

Maybe someone of you happen to have time to test this in the latest 3.x implementation for Plone 6 ... SubformAdapter got removed there and the DictRow schema can have plone.autoform hints ... no need for datagridUpdateWidgets anymore ...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
2 participants