From 1892f558b931d3fe0fb85e629ad5f21650624d51 Mon Sep 17 00:00:00 2001 From: mauritsvanrees Date: Thu, 29 Sep 2016 16:06:41 +0200 Subject: [PATCH] [fc] Repository: plone.app.z3cform Branch: refs/heads/1.x Date: 2016-09-29T13:18:16+02:00 Author: Maurits van Rees (mauritsvanrees) Commit: https://github.com/plone/plone.app.z3cform/commit/3ed66a1dc8e2b111f1a482e2cb0c6d7e93f341c3 In select widget, accept items as property or method. This avoids breaking on some z3c.form versions. See https://github.com/zopefoundation/z3c.form/issues/44 Files changed: M CHANGES.rst M plone/app/z3cform/widget.py Repository: plone.app.z3cform Branch: refs/heads/1.x Date: 2016-09-29T16:06:41+02:00 Author: Maurits van Rees (mauritsvanrees) Commit: https://github.com/plone/plone.app.z3cform/commit/4ae827f13f39bbab57074b48f316b15a6a072742 Merge pull request #50 from plone/select-widget-items-callable-1x In select widget, accept items as property or method. [1.x] Files changed: M CHANGES.rst M plone/app/z3cform/widget.py --- last_commit.txt | 197 +++++++++++++++++++++--------------------------- 1 file changed, 86 insertions(+), 111 deletions(-) diff --git a/last_commit.txt b/last_commit.txt index a49cfa66b4..fe4da9de60 100644 --- a/last_commit.txt +++ b/last_commit.txt @@ -1,138 +1,113 @@ -Repository: plone.cachepurging +Repository: plone.app.z3cform -Branch: refs/heads/master -Date: 2016-09-29T15:08:51+02:00 +Branch: refs/heads/1.x +Date: 2016-09-29T13:18:16+02:00 Author: Maurits van Rees (mauritsvanrees) -Commit: https://github.com/plone/plone.cachepurging/commit/a0604973a04802b8a0d618f2f49ae43f207f0000 +Commit: https://github.com/plone/plone.app.z3cform/commit/3ed66a1dc8e2b111f1a482e2cb0c6d7e93f341c3 -Restored info from 1.0.12 release. +In select widget, accept items as property or method. -I released this to PyPI on 8 August, but apparently forgot to push. -Note: the 1.0.12 tag is there. +This avoids breaking on some z3c.form versions. +See https://github.com/zopefoundation/z3c.form/issues/44 Files changed: M CHANGES.rst -M plone/cachepurging/tests/test_utils.py -M setup.py +M plone/app/z3cform/widget.py diff --git a/CHANGES.rst b/CHANGES.rst -index 336e031..798c1f1 100644 +index 880181e..82f18e9 100644 --- a/CHANGES.rst +++ b/CHANGES.rst -@@ -1,7 +1,7 @@ - Changelog - ========= - --1.0.12 (unreleased) -+1.0.13 (unreleased) - ------------------- - - Breaking changes: -@@ -14,10 +14,19 @@ New features: +@@ -14,7 +14,10 @@ New features: Bug fixes: --- Code-Style: isort, utf8-headers, zca-decorators, manual cleanup. -+- Code-Style: isort, utf8-headers, manual cleanup. - [jensens] - - -+1.0.12 (2016-08-08) -+------------------- -+ -+New features: -+ -+- Use zope.interface decorator. -+ [gforcada] -+ -+ - 1.0.11 (2016-01-08) - ------------------- - -diff --git a/plone/cachepurging/tests/test_utils.py b/plone/cachepurging/tests/test_utils.py -index 3b8e20b..eba88ea 100644 ---- a/plone/cachepurging/tests/test_utils.py -+++ b/plone/cachepurging/tests/test_utils.py -@@ -10,7 +10,6 @@ - from zope.component import adapter - from zope.component import provideAdapter - from zope.component import provideUtility --from zope.interface import implements - from zope.interface import implementer - - import unittest -@@ -159,7 +158,6 @@ def getAbsolutePaths(self): - @implementer(IPurgePathRewriter) - @adapter(FauxRequest) - class DefaultRewriter(object): -- implements(IPurgePathRewriter) - adapts(FauxRequest) - - def __init__(self, request): -@@ -233,8 +231,9 @@ def __call__(self, path): - ) - - def test_rewriter_abort(self): -+ -+ @implementer(IPurgePaths) - class FauxPurgePaths1(object): -- implements(IPurgePaths) - adapts(FauxContext) - - def __init__(self, context): -diff --git a/setup.py b/setup.py -index 5631b7e..859fb79 100644 ---- a/setup.py -+++ b/setup.py -@@ -1,6 +1,6 @@ - from setuptools import setup, find_packages - --version = '1.0.12.dev0' -+version = '1.0.13.dev0' - - setup( - name='plone.cachepurging', +-- *add item here* ++- In select widget, accept items as property or method. ++ This avoids breaking on some z3c.form versions. ++ See https://github.com/zopefoundation/z3c.form/issues/44 ++ [maurits] + + + 1.2.1 (2016-04-29) +diff --git a/plone/app/z3cform/widget.py b/plone/app/z3cform/widget.py +index f3b3e2e..253a779 100644 +--- a/plone/app/z3cform/widget.py ++++ b/plone/app/z3cform/widget.py +@@ -255,8 +255,16 @@ def _base_args(self): + if not self.required: + options['allowClear'] = True + ++ base_items = self.items ++ if callable(base_items): ++ # items used to be a property in all widgets, then in the select ++ # widget it became a method, then in a few others too, but never in ++ # all, so this was reverted to let it be a property again. Let's ++ # support both here to avoid breaking on some z3c.form versions. ++ # See https://github.com/zopefoundation/z3c.form/issues/44 ++ base_items = base_items() + items = [] +- for item in self.items(): ++ for item in base_items: + if not isinstance(item['content'], basestring): + item['content'] = translate( + item['content'], -Repository: plone.cachepurging +Repository: plone.app.z3cform -Branch: refs/heads/master -Date: 2016-09-29T15:09:07+02:00 +Branch: refs/heads/1.x +Date: 2016-09-29T16:06:41+02:00 Author: Maurits van Rees (mauritsvanrees) -Commit: https://github.com/plone/plone.cachepurging/commit/a2af92c55e24c5c3de2990e50f9eeb6f03122c3d +Commit: https://github.com/plone/plone.app.z3cform/commit/4ae827f13f39bbab57074b48f316b15a6a072742 -Use implementer in README too. +Merge pull request #50 from plone/select-widget-items-callable-1x + +In select widget, accept items as property or method. [1.x] Files changed: -M README.rst - -diff --git a/README.rst b/README.rst -index 174ef01..f8dabb9 100644 ---- a/README.rst -+++ b/README.rst -@@ -303,19 +303,19 @@ Let's say you wanted to always purge the URL ``${object_url}/view`` for any - object providing ``IContentish`` from CMF. A simple implementation may look - like this:: - -- from zope.interface import implements -+ from zope.interface import implementer - from zope.component import adapts - - from z3c.caching.interfaces import IPurgePaths - - from Products.CMFCore.interfaces import IContentish - -+ @implementer(IPurgePaths) - class ObjectViewPurgePaths(object): - """Purge /view for any content object with the content object's - default URL - """ +M CHANGES.rst +M plone/app/z3cform/widget.py + +diff --git a/CHANGES.rst b/CHANGES.rst +index 880181e..82f18e9 100644 +--- a/CHANGES.rst ++++ b/CHANGES.rst +@@ -14,7 +14,10 @@ New features: -- implements(IPurgePaths) - adapts(IContentish) + Bug fixes: - def __init__(self, context): +-- *add item here* ++- In select widget, accept items as property or method. ++ This avoids breaking on some z3c.form versions. ++ See https://github.com/zopefoundation/z3c.form/issues/44 ++ [maurits] + + + 1.2.1 (2016-04-29) +diff --git a/plone/app/z3cform/widget.py b/plone/app/z3cform/widget.py +index f3b3e2e..253a779 100644 +--- a/plone/app/z3cform/widget.py ++++ b/plone/app/z3cform/widget.py +@@ -255,8 +255,16 @@ def _base_args(self): + if not self.required: + options['allowClear'] = True + ++ base_items = self.items ++ if callable(base_items): ++ # items used to be a property in all widgets, then in the select ++ # widget it became a method, then in a few others too, but never in ++ # all, so this was reverted to let it be a property again. Let's ++ # support both here to avoid breaking on some z3c.form versions. ++ # See https://github.com/zopefoundation/z3c.form/issues/44 ++ base_items = base_items() + items = [] +- for item in self.items(): ++ for item in base_items: + if not isinstance(item['content'], basestring): + item['content'] = translate( + item['content'],