collective / collective.z3cform.datagridfield

Datagrid Field for z3c.forms
https://pypi.org/project/collective.z3cform.datagridfield/
8 stars 28 forks source link

Wrong name in named utility? #186

Closed yurj closed 5 months ago

yurj commented 6 months ago

https://github.com/collective/collective.z3cform.datagridfield/blob/b8f83531aad8f46678f1db715ded5d890ce68393/src/collective/z3cform/datagridfield/configure.zcml#L80

Shouldn't be collective.z3cform.datagridfield.row.DictRow? The IFieldExportImportHandler expects the classpath, it is used when adding a new field TTW to reprocess the DGF entry in the modeleditor: https://github.com/plone/plone.supermodel/blob/bd94c73a2d4fa3690be5eb91063509b48d681425/plone/supermodel/exportimport.py#L227

When using the model editor to add a List field with a DGF widget (value_type and schema tags), the value_type and schema tags disappear because supermodel query with collective.z3cform.datagridfield.row.DictRow.

petschki commented 5 months ago

Absolutely right. Fixed that here: https://github.com/collective/collective.z3cform.datagridfield/pull/187/commits/5fe99f84f399bcf2643fc9a2f77dbdfa7ff0d2b2 and added a working example here https://github.com/collective/collective.z3cform.datagridfield/blob/834a14b27444ae1c38cff2ba221c7e602ad24acc/src/collective/z3cform/datagridfield/demo/dgftest.xml

petschki commented 5 months ago

fixed in https://github.com/collective/collective.z3cform.datagridfield/pull/187

mtrebron commented 4 months ago

@petschki @yurj The fix appears to break existing TTW content types. Even accessing the model editor directly or attempting to export the schema is now broken.

2024-06-19 05:47:35,977 ERROR   [Zope.SiteErrorLog:17][waitress-0] SupermodelParseError: http://localhost:8888/Plone/dexterity-types/dgftest
Traceback (innermost last):
  Module ZPublisher.WSGIPublisher, line 181, in transaction_pubevents
  Module ZPublisher.WSGIPublisher, line 391, in publish_module
  Module ZPublisher.WSGIPublisher, line 269, in publish
  Module ZPublisher.BaseRequest, line 515, in traverse
  Module ZPublisher.BaseRequest, line 340, in traverseName
  Module plone.app.dexterity.browser.types, line 289, in publishTraverse
  Module plone.dexterity.fti, line 246, in lookupSchema
  Module plone.alterego.dynamic, line 26, in __getattr__
  Module plone.dexterity.synchronize, line 10, in synchronized_function
  Module plone.dexterity.schema, line 407, in __call__
  Module plone.dexterity.fti, line 250, in lookupModel
  Module plone.supermodel, line 34, in loadString
  Module plone.supermodel.parser, line 74, in parse
plone.supermodel.parser.SupermodelParseError: Type collective.z3cform.datagridfield.DictRow used for value_type not supported
  File "<unknown>", line 8
  File "/usr/local/Plone6/lib/python3.8/site-packages/plone/supermodel/parser.py", line 68, in parse
    return _parse(source, policy)
  File "/usr/local/Plone6/lib/python3.8/site-packages/plone/supermodel/parser.py", line 152, in _parse
    readField(fieldElement, schemaAttributes, fieldElements, baseFields)
  File "/usr/local/Plone6/lib/python3.8/site-packages/plone/supermodel/parser.py", line 117, in readField
    field = handler.read(fieldElement)
  File "/usr/local/Plone6/lib/python3.8/site-packages/plone/supermodel/exportimport.py", line 114, in read
    raise NotImplementedError(
[12] > /usr/local/Plone6/lib/python3.8/site-packages/plone/supermodel/parser.py(74)parse()
-> raise SupermodelParseError(e, fname, parseinfo.stack[-1], sys.exc_info()[2])
mtrebron commented 4 months ago

Sorry for the noise, the existing schema can be fixed using portal_types in the ZMI.

yurj commented 4 months ago

Sorry for the noise, the existing schema can be fixed using portal_types in the ZMI.

but maybe an upgrade step could help? Or at least a release note that helps in fixing it?