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

Fix implementation for sub form adapter #116

Closed
wants to merge 1 commit into from
Closed

Conversation

thomasmassmann
Copy link
Member

The sub form adapter needs a different signature than originally provided.

With those changes it is possible to have an AutoExtensibleForm as sub form in a data grid field.

This fixes #114.

There is another PR for this: #115. But I don’t think we should remove it.

@jensens, what’s your opinion on this?

@jensens
Copy link
Member

jensens commented Dec 15, 2021

My first thought is: Attention we use an outdated z3c.form in Plone and the API you use just does not exist in the latest major release https://github.com/zopefoundation/z3c.form/blob/master/src/z3c/form/object.py and https://github.com/zopefoundation/z3c.form/blob/master/CHANGES.rst#330-2016-03-09

And the reason we use an outdated z3c.form is exactly this removal.

@thomasmassmann
Copy link
Member Author

Attention we use an outdated z3c.form in Plone and the API you use just does not exist in the latest major release

Then we should remove it and merge #115 and close this one.

And the reason we use an outdated z3c.form is exactly this removal.

So you are saying we need to keep using a version from 5 years ago because of the removed ObjectSubForm and SubFormAdapter? If it is required in Plone, why not add it to plone.z3cform instead and use the latest stable release of z3c.form?

@jensens
Copy link
Member

jensens commented Dec 15, 2021

So you are saying we need to keep using a version from 5 years ago because of the removed ObjectSubForm and SubFormAdapter? If it is required in Plone, why not add it to plone.z3cform instead and use the latest stable release of z3c.form?

Yes, its that worse. Nobody ever looked into it. It is probably time. But my personal z3c.form Zen-level was never enough for this.
Putting it in plone.z3cform is a good idea. Would you give it a try?

@thomasmassmann
Copy link
Member Author

I can start a PR. Ticket is created: plone/plone.z3cform#19

@thomasmassmann
Copy link
Member Author

But how do we proceed with this PR and #114?

Do we remove the custom adapter here? Do we actually need it? I tried without and it still works as expected.

@jensens
Copy link
Member

jensens commented Dec 16, 2021

But how do we proceed with this PR and #114?

Do we remove the custom adapter here? Do we actually need it? I tried without and it still works as expected.

I am not deep enough into this, may @thet has an opinion on this? Or we make this more visible at community.plone.org?

@thet
Copy link
Member

thet commented Mar 14, 2022

I'm not sure why this this AutoExtensibleSubformAdapter is needed at all. If the plone.autoform forms (basically all automatically schema-generated forms in Plone) still do work with datagridfield, then the adapter seems superfluous. Especially as it looks like it's adding generic subform support to plone.autoforms where we already should have that in core.

Sometimes it helps to look at the history.

The adapter was added here, in 2012:
4198925

Although that doesn't tell me much either.

However, using an outdated z3c.form API is not a problem in my opinion. We ARE using the outdated z3c.form API.
I do like the idea of adding subform support to plone.z3cform and be able to upgrade z3c.form. And once we have it we can also update the imports in this package.

I think @thomasmassmann's fix is totally valid, if we need it at all.

@thet
Copy link
Member

thet commented Mar 14, 2022

@petschki
Copy link
Member

petschki commented Mar 16, 2022

I'd recommend removing the ZCML registration with #115 and get rid of ObjectSubForm and SubformAdapter completely in a second step ... it's never used in Plone 6 anymore ...

@petschki
Copy link
Member

so in the meantime coredev build is green with the latest z3c.form plone/buildout.coredev#782 and might get merged soon for Plone 6 ... but I think the whole subform implementation has to be rewritten here. Maybe the docs have some pointers for that: https://z3cform.readthedocs.io/en/latest/mustread/subform.html

@mauritsvanrees
Copy link
Member

so in the meantime coredev build is green with the latest z3c.form plone/buildout.coredev#782 and might get merged soon for Plone 6 ... but I think the whole subform implementation has to be rewritten here. Maybe the docs have some pointers for that: https://z3cform.readthedocs.io/en/latest/mustread/subform.html

I thought the idea was that you (or someone else) would copy the subform implementation from z3c.form 3.x to plone.z3cform. If that is not the case, then I wonder what the value is of switching to latest z3c.form. collective.z3c.datagridfield would be broken.
Or am I misinterpreting things?

@petschki
Copy link
Member

petschki commented Mar 22, 2022

That was my first intention when investigating z3c.form update in coredev. But this SubFormAdapter implementation has no effect here at all so I think it would be better to keep the code here up to date to the latest z3c.form.object api.

@petschki
Copy link
Member

petschki commented Mar 22, 2022

For the sake of completeness: due to the fact, that plone.autoform needs those removed adapters in order to make form schema hints working on zope.schema.Object subforms I've backported it to plone.z3cform and re-enabled an updated version of the subform.txt doctest to demonstrate the new imports here plone/plone.autoform#41

I'll change this create a new PR to use the backported implementation from plone.z3cform with a fallback to old z3c.form so this should be a backwards compatible change here. (breaking change in Plone 6)

@petschki
Copy link
Member

this got fixed in #120

@petschki petschki closed this May 23, 2022
@thet thet deleted the bug/114 branch May 23, 2022 13:50
@thomasmassmann thomasmassmann restored the bug/114 branch December 5, 2022 10:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

AutoExtensibleSubformAdapter breaks the schema editor settings popup for certain fields
5 participants