Vendor the datagrid widget and drop collective.z3cform.datagridfield - #2990
Open
ramonski wants to merge 7 commits into
Open
Vendor the datagrid widget and drop collective.z3cform.datagridfield#2990ramonski wants to merge 7 commits into
ramonski wants to merge 7 commits into
Conversation
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.
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
force-pushed
the
vendor/drop-collective-datagridfield
branch
from
July 15, 2026 06:53
da5a304 to
b9e4ee6
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description of the issue/feature this PR addresses
The DX datagrid widget machinery was provided by the (largely unmaintained)
collective.z3cform.datagridfieldpackage. 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.datagridfieldand drops the external dependency.Current behavior before PR
collective.z3cform.datagridfieldis 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 specificDataGridFieldObjectwidget are registered; the genericAutoExtensibleSubformAdapterand the cosmeticMultipleErrorViewSnippetWithMessageare 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 onISenaiteFormLayer.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.