From b091e59f4c1a8e924e4728a193f547e9824e55fd Mon Sep 17 00:00:00 2001 From: jensens Date: Tue, 21 Dec 2021 17:26:23 +0100 Subject: [PATCH] [fc] Repository: plone.dexterity Branch: refs/heads/master Date: 2021-12-20T12:42:18+01:00 Author: Maurits van Rees (mauritsvanrees) Commit: https://github.com/plone/plone.dexterity/commit/d1e04956adcc27cc7a266dd8e61aaf0ee22cc3ca Plone 6: Always use a lines property for behaviors, no longer the deprecated ulines. Part of https://github.com/plone/Products.CMFPlone/issues/3305. Note: I have switched coredev 5.2 to use `plone.dexterity` branch 2.x. Files changed: A news/3305.bugfix M plone/dexterity/fti.py Repository: plone.dexterity Branch: refs/heads/master Date: 2021-12-21T17:26:23+01:00 Author: Jens W. Klein (jensens) Commit: https://github.com/plone/plone.dexterity/commit/e43f08b68a46286ec12423991237c60d102af4fe Merge pull request #161 from plone/no-ulines Plone 6: Always use lines property for behaviors, no longer ulines Files changed: A news/3305.bugfix M plone/dexterity/fti.py --- last_commit.txt | 39 +++++++++++++++++---------------------- 1 file changed, 17 insertions(+), 22 deletions(-) diff --git a/last_commit.txt b/last_commit.txt index 63b8911c05..795c258481 100644 --- a/last_commit.txt +++ b/last_commit.txt @@ -1,42 +1,37 @@ -Repository: diazo +Repository: plone.dexterity Branch: refs/heads/master -Date: 2021-12-17T23:21:28+01:00 +Date: 2021-12-20T12:42:18+01:00 Author: Maurits van Rees (mauritsvanrees) -Commit: https://github.com/plone/diazo/commit/ef3b849f2b8aa9f07a54c639740eba40a0c6f0e9 +Commit: https://github.com/plone/plone.dexterity/commit/d1e04956adcc27cc7a266dd8e61aaf0ee22cc3ca -Remove FormEncode test dependency. +Plone 6: Always use a lines property for behaviors, no longer the deprecated ulines. -Instead copy its xml_compare and text_compare functions. -Taken from version 2.0.1. - -I ran into a problem compiling the 1.3.1 egg, so I looked into who was using FormEncode in Plone, -and it turned out to only be a test dependency of Diazo. +Part of https://github.com/plone/Products.CMFPlone/issues/3305. +Note: I have switched coredev 5.2 to use `plone.dexterity` branch 2.x. Files changed: -A news/83.bugfix -M lib/diazo/tests/test_diazo.py -M setup.py +A news/3305.bugfix +M plone/dexterity/fti.py -b'diff --git a/lib/diazo/tests/test_diazo.py b/lib/diazo/tests/test_diazo.py\nindex 3853413..fdf7b8d 100644\n--- a/lib/diazo/tests/test_diazo.py\n+++ b/lib/diazo/tests/test_diazo.py\n@@ -3,7 +3,6 @@\n from __future__ import print_function\n \n from diazo.utils import quote_param\n-from formencode.doctest_xml_compare import xml_compare\n from future.builtins import str\n from io import BytesIO\n from io import open\n@@ -15,6 +14,7 @@\n import difflib\n import os\n import pkg_resources\n+import six\n import sys\n import unittest\n \n@@ -39,6 +39,68 @@\n )\n \n \n+def text_compare(t1, t2):\n+ # Copied from formencode.doctest_xml_compare.text_compare 2.0.1.\n+ # See note in xml_compare below.\n+ if not t1 and not t2:\n+ return True\n+ if t1 == \'*\' or t2 == \'*\':\n+ return True\n+ return (t1 or \'\').strip() == (t2 or \'\').strip()\n+\n+\n+def xml_compare(x1, x2):\n+ """Compare two xml items.\n+\n+ Copied from formencode.doctest_xml_compare.xml_compare 2.0.1,\n+ without the (unused by us) optional \'reporter\' argument.\n+\n+ License: MIT\n+\n+ Copyright (c) 2015 Ian Bicking and FormEncode Contributors\n+\n+ Permission is hereby granted, free of charge, to any person obtaining a copy\n+ of this software and associated documentation files (the "Software"), to deal\n+ in the Software without restriction, including without limitation the rights\n+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n+ copies of the Software, and to permit persons to whom the Software is\n+ furnished to do so, subject to the following conditions:\n+\n+ The above copyright notice and this permission notice shall be included in\n+ all copies or substantial portions of the Software.\n+\n+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n+ THE SOFTWARE.\n+ """\n+ if x1.tag != x2.tag:\n+ return False\n+ for name, value in six.iteritems(x1.attrib):\n+ if x2.attrib.get(name) != value:\n+ return False\n+ for name in x2.attrib:\n+ if name not in x1.attrib:\n+ return False\n+ if not text_compare(x1.text, x2.text):\n+ return False\n+ if not text_compare(x1.tail, x2.tail):\n+ return False\n+ cl1 = list(x1)\n+ cl2 = list(x2)\n+ if len(cl1) != len(cl2):\n+ return False\n+ i = 0\n+ for c1, c2 in zip(cl1, cl2):\n+ i += 1\n+ if not xml_compare(c1, c2):\n+ return False\n+ return True\n+\n+\n class DiazoTestCase(unittest.TestCase):\n \n writefiles = os.environ.get(\'DiazoTESTS_WRITE_FILES\', False)\ndiff --git a/news/83.bugfix b/news/83.bugfix\nnew file mode 100644\nindex 0000000..59cfad9\n--- /dev/null\n+++ b/news/83.bugfix\n@@ -0,0 +1,2 @@\n+Remove FormEncode test dependency.\n+[maurits]\ndiff --git a/setup.py b/setup.py\nindex 3994bbb..60f9d5e 100644\n--- a/setup.py\n+++ b/setup.py\n@@ -10,7 +10,6 @@\n \'WebOb\',\n ],\n \'test\': [\n- \'formencode\',\n \'repoze.xmliter\',\n \'WebOb\',\n ],\n' +b'diff --git a/news/3305.bugfix b/news/3305.bugfix\nnew file mode 100644\nindex 0000000..0d4d3c6\n--- /dev/null\n+++ b/news/3305.bugfix\n@@ -0,0 +1,3 @@\n+Plone 6: Always use a lines property for behaviors, no longer the deprecated ulines.\n+Part of `issue 3305 `_.\n+[maurits]\ndiff --git a/plone/dexterity/fti.py b/plone/dexterity/fti.py\nindex abea8c2..e918ef4 100644\n--- a/plone/dexterity/fti.py\n+++ b/plone/dexterity/fti.py\n@@ -63,10 +63,6 @@ class DexterityFTI(base.DynamicViewTypeInformation):\n \n meta_type = "Dexterity FTI"\n \n- behaviors_type = "ulines"\n- if six.PY2:\n- behaviors_type = "lines"\n-\n _properties = base.DynamicViewTypeInformation._properties + (\n {\n "id": "add_permission",\n@@ -86,7 +82,7 @@ class DexterityFTI(base.DynamicViewTypeInformation):\n },\n {\n "id": "behaviors",\n- "type": behaviors_type,\n+ "type": "ulines",\n "mode": "w",\n "label": "Behaviors",\n "description": "Names of enabled behaviors type",\n' -Repository: diazo +Repository: plone.dexterity Branch: refs/heads/master -Date: 2021-12-20T11:54:54+01:00 +Date: 2021-12-21T17:26:23+01:00 Author: Jens W. Klein (jensens) -Commit: https://github.com/plone/diazo/commit/5f8c07b13392bb606ac4f1879a9dbb1b2912a81e +Commit: https://github.com/plone/plone.dexterity/commit/e43f08b68a46286ec12423991237c60d102af4fe -Merge pull request #83 from plone/maurits-remove-formencode +Merge pull request #161 from plone/no-ulines -Remove FormEncode test dependency. +Plone 6: Always use lines property for behaviors, no longer ulines Files changed: -A news/83.bugfix -M lib/diazo/tests/test_diazo.py -M setup.py +A news/3305.bugfix +M plone/dexterity/fti.py -b'diff --git a/lib/diazo/tests/test_diazo.py b/lib/diazo/tests/test_diazo.py\nindex 3853413..fdf7b8d 100644\n--- a/lib/diazo/tests/test_diazo.py\n+++ b/lib/diazo/tests/test_diazo.py\n@@ -3,7 +3,6 @@\n from __future__ import print_function\n \n from diazo.utils import quote_param\n-from formencode.doctest_xml_compare import xml_compare\n from future.builtins import str\n from io import BytesIO\n from io import open\n@@ -15,6 +14,7 @@\n import difflib\n import os\n import pkg_resources\n+import six\n import sys\n import unittest\n \n@@ -39,6 +39,68 @@\n )\n \n \n+def text_compare(t1, t2):\n+ # Copied from formencode.doctest_xml_compare.text_compare 2.0.1.\n+ # See note in xml_compare below.\n+ if not t1 and not t2:\n+ return True\n+ if t1 == \'*\' or t2 == \'*\':\n+ return True\n+ return (t1 or \'\').strip() == (t2 or \'\').strip()\n+\n+\n+def xml_compare(x1, x2):\n+ """Compare two xml items.\n+\n+ Copied from formencode.doctest_xml_compare.xml_compare 2.0.1,\n+ without the (unused by us) optional \'reporter\' argument.\n+\n+ License: MIT\n+\n+ Copyright (c) 2015 Ian Bicking and FormEncode Contributors\n+\n+ Permission is hereby granted, free of charge, to any person obtaining a copy\n+ of this software and associated documentation files (the "Software"), to deal\n+ in the Software without restriction, including without limitation the rights\n+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n+ copies of the Software, and to permit persons to whom the Software is\n+ furnished to do so, subject to the following conditions:\n+\n+ The above copyright notice and this permission notice shall be included in\n+ all copies or substantial portions of the Software.\n+\n+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n+ THE SOFTWARE.\n+ """\n+ if x1.tag != x2.tag:\n+ return False\n+ for name, value in six.iteritems(x1.attrib):\n+ if x2.attrib.get(name) != value:\n+ return False\n+ for name in x2.attrib:\n+ if name not in x1.attrib:\n+ return False\n+ if not text_compare(x1.text, x2.text):\n+ return False\n+ if not text_compare(x1.tail, x2.tail):\n+ return False\n+ cl1 = list(x1)\n+ cl2 = list(x2)\n+ if len(cl1) != len(cl2):\n+ return False\n+ i = 0\n+ for c1, c2 in zip(cl1, cl2):\n+ i += 1\n+ if not xml_compare(c1, c2):\n+ return False\n+ return True\n+\n+\n class DiazoTestCase(unittest.TestCase):\n \n writefiles = os.environ.get(\'DiazoTESTS_WRITE_FILES\', False)\ndiff --git a/news/83.bugfix b/news/83.bugfix\nnew file mode 100644\nindex 0000000..59cfad9\n--- /dev/null\n+++ b/news/83.bugfix\n@@ -0,0 +1,2 @@\n+Remove FormEncode test dependency.\n+[maurits]\ndiff --git a/setup.py b/setup.py\nindex 3994bbb..60f9d5e 100644\n--- a/setup.py\n+++ b/setup.py\n@@ -10,7 +10,6 @@\n \'WebOb\',\n ],\n \'test\': [\n- \'formencode\',\n \'repoze.xmliter\',\n \'WebOb\',\n ],\n' +b'diff --git a/news/3305.bugfix b/news/3305.bugfix\nnew file mode 100644\nindex 0000000..0d4d3c6\n--- /dev/null\n+++ b/news/3305.bugfix\n@@ -0,0 +1,3 @@\n+Plone 6: Always use a lines property for behaviors, no longer the deprecated ulines.\n+Part of `issue 3305 `_.\n+[maurits]\ndiff --git a/plone/dexterity/fti.py b/plone/dexterity/fti.py\nindex abea8c2..e918ef4 100644\n--- a/plone/dexterity/fti.py\n+++ b/plone/dexterity/fti.py\n@@ -63,10 +63,6 @@ class DexterityFTI(base.DynamicViewTypeInformation):\n \n meta_type = "Dexterity FTI"\n \n- behaviors_type = "ulines"\n- if six.PY2:\n- behaviors_type = "lines"\n-\n _properties = base.DynamicViewTypeInformation._properties + (\n {\n "id": "add_permission",\n@@ -86,7 +82,7 @@ class DexterityFTI(base.DynamicViewTypeInformation):\n },\n {\n "id": "behaviors",\n- "type": behaviors_type,\n+ "type": "ulines",\n "mode": "w",\n "label": "Behaviors",\n "description": "Names of enabled behaviors type",\n'