From 317e00cce1d1ba07e76f48f139220b79a4c1d7b6 Mon Sep 17 00:00:00 2001 From: Peter Mathis Date: Mon, 13 Jan 2025 11:37:30 +0100 Subject: [PATCH 1/2] Use `plone.app.z3cform.widgets.OrderedSelect` in Plone 6.1 --- CHANGES.rst | 3 +- src/collective/taxonomy/widget.py | 8 +- src/collective/taxonomy/widget_input.pt | 367 +++++++----------------- 3 files changed, 109 insertions(+), 269 deletions(-) diff --git a/CHANGES.rst b/CHANGES.rst index d944b60..ec4e7f0 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -14,7 +14,8 @@ New features: Bug fixes: -- *add item here* +- Use `plone.app.z3cform.widgets.OrderedSelect` in Plone 6.1 + [petschki] 3.1.5 (2024-11-05) diff --git a/src/collective/taxonomy/widget.py b/src/collective/taxonomy/widget.py index 0706849..a8e16aa 100644 --- a/src/collective/taxonomy/widget.py +++ b/src/collective/taxonomy/widget.py @@ -1,7 +1,6 @@ from collective.taxonomy.interfaces import ITaxonomySelectWidget from plone.memoize import ram from z3c.form import interfaces -from z3c.form.browser.orderedselect import OrderedSelectWidget from z3c.form.widget import FieldWidget import zope.component @@ -9,6 +8,13 @@ import zope.schema.interfaces +try: + # Plone 6.1 + from plone.app.z3cform.widgets.orderedselect import OrderedSelectWidget +except ImportError: + from z3c.form.browser.orderedselect import OrderedSelectWidget + + def _items_cachekey(fun, self): # try to get modified time of taxonomy utility try: diff --git a/src/collective/taxonomy/widget_input.pt b/src/collective/taxonomy/widget_input.pt index 0a742d6..ddd4d7b 100644 --- a/src/collective/taxonomy/widget_input.pt +++ b/src/collective/taxonomy/widget_input.pt @@ -3,276 +3,109 @@ xmlns:tal="http://xml.zope.org/namespaces/tal" tal:omit-tag="" > - - - - - - - - - - - - -
- -
- - -
- - - - + + + + + + + + +
+ + + +
+ +
+ + + + + + + +
+ +
-
From 4f16228fa79d9e028bfaabacb8b559754fa8a776 Mon Sep 17 00:00:00 2001 From: Peter Mathis Date: Mon, 13 Jan 2025 11:41:18 +0100 Subject: [PATCH 2/2] update plone setup action --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 0d12d98..e3964a2 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -38,7 +38,7 @@ jobs: - name: Setup Plone ${{ matrix.plone }} with Python ${{ matrix.python }} id: setup - uses: plone/setup-plone@v2.0.0 + uses: plone/setup-plone@v3.0.0 with: python-version: ${{ matrix.python }} plone-version: ${{ matrix.plone }}