Skip to content

Vendor the datagrid widget and drop collective.z3cform.datagridfield - #2990

Open
ramonski wants to merge 7 commits into
2.xfrom
vendor/drop-collective-datagridfield
Open

Vendor the datagrid widget and drop collective.z3cform.datagridfield#2990
ramonski wants to merge 7 commits into
2.xfrom
vendor/drop-collective-datagridfield

Conversation

@ramonski

@ramonski ramonski commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Description of the issue/feature this PR addresses

The DX datagrid widget machinery was provided by the (largely unmaintained) collective.z3cform.datagridfield package. senaite.core already shipped its own widget factories, interfaces, field/row subclasses and templates on top of it; the only remaining coupling was five symbols (DictRow, IRow, IDataGridField, DataGridField, DataGridFieldObject) across four modules, plus the adapters the package registered via autoinclude.

This PR vendors the consumed parts into senaite.core.z3cform.datagridfield and drops the external dependency.

Current behavior before PR

collective.z3cform.datagridfield is a hard runtime dependency (install_requires) for a small, stable set of base classes and adapters.

Desired behavior after PR is merged

The datagrid widget base classes (DataGridField, DataGridFieldObject), DictRow, the interfaces, the autoform subform support, the data converter and the validator live in senaite.core. Only the adapters keyed to the specific DataGridFieldObject widget are registered; the generic AutoExtensibleSubformAdapter and the cosmetic MultipleErrorViewSnippetWithMessage are intentionally not registered (no other senaite.core widget uses them, and this keeps the registration conflict-free). The upstream widget templates are not vendored, since senaite.core already provides its own on ISenaiteFormLayer.

The block widget, demo, GenericSetup profiles and transmogrify/supermodel helpers are dropped. Persisted values are plain lists of dicts and are unaffected, so no migration is required. A buildout re-run is required to remove the dropped dependency.

Verified by running the datagrid-backed doctests (SampleTemplate, Calculations, WorksheetApplyTemplate, ServicesCalculationRecursion) and flake8.

--
I confirm I have tested this PR thoroughly and coded it according to PEP8 and Plone's Python styleguide standards.

The datagrid widget machinery was provided by the (largely unmaintained)
collective.z3cform.datagridfield package. senaite.core already shipped its
own widget factories, interfaces, field/row subclasses and templates on top
of it; the only remaining coupling was five symbols (DictRow, IRow,
IDataGridField, DataGridField, DataGridFieldObject) plus the adapters the
package registered via autoinclude.

Vendor the consumed parts into senaite.core.z3cform.datagridfield (widget
base classes, DictRow, interfaces, autoform subform support, converter and
validator) and register only the adapters that are keyed to the specific
DataGridFieldObject widget. The generic AutoExtensibleSubformAdapter and the
cosmetic MultipleErrorViewSnippetWithMessage are intentionally not
registered: no other senaite.core widget uses them, and this keeps the
registration free of conflicts. The upstream widget templates are not
vendored either, since senaite.core provides its own on ISenaiteFormLayer.

The block widget, demo, GenericSetup profiles and transmogrify/supermodel
helpers are dropped. Persisted values are plain lists of dicts and are
unaffected, so no migration is required.

Requires a buildout re-run to remove the dropped dependency.
Comment thread src/senaite/core/z3cform/datagridfield/datagridfield.py Fixed
ramonski added 4 commits July 15, 2026 08:39
Add a final `return False` so the method never implicitly returns None on
an unexpected row suffix. In INPUT_MODE the existing checks are exhaustive,
so behavior is unchanged.
Import senaiteMessageFactory instead of registering a second MessageFactory
for the same 'senaite.core' domain.
senaite.core does not use Patternslib (pat-* classes), so the render()
override that rewrote pat- to dgw-disabled-pat- on template/auto-append
rows is dead code. Remove it (rows now use ObjectWidget.render directly)
along with the PAT_XPATH constant and the lxml import.
Cover the request submission contract the form adapters and client depend
on: extract() returns rows in order, ignores the auto-append (AA) and
template (TT) rows, handles an empty grid, and the counter marker excludes
AA/TT. Collected by test_z3c_widgets alongside the other widget doctests.
@ramonski
ramonski force-pushed the vendor/drop-collective-datagridfield branch from da5a304 to b9e4ee6 Compare July 15, 2026 06:53
@ramonski
ramonski requested a review from xispa July 15, 2026 07:08
@ramonski ramonski added the Cleanup 🧹 Code cleanup and refactoring label Jul 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Cleanup 🧹 Code cleanup and refactoring

Development

Successfully merging this pull request may close these issues.

1 participant