diff --git a/last_commit.txt b/last_commit.txt index 8b6fd726ec..37417af03c 100644 --- a/last_commit.txt +++ b/last_commit.txt @@ -1,34 +1,43 @@ -Repository: plone.app.contentmenu +Repository: plone.releaser Branch: refs/heads/master -Date: 2023-08-18T10:45:20+02:00 -Author: Sébastien Verbois (sverbois) -Commit: https://github.com/plone/plone.app.contentmenu/commit/fa43cb9e35ca800f63f16b79ef5607d560e92367 +Date: 2023-09-14T20:59:13+02:00 +Author: Maurits van Rees (mauritsvanrees) +Commit: https://github.com/plone/plone.releaser/commit/b60db647cc6d0b4360a75f6aea38853286b974a3 + +Fix setting version for non-lowercase package. -Fix #54 : "Add item to default page" modal form +In the previous release this would add a duplicate line. +Fixes https://github.com/plone/plone.releaser/issues/58 Files changed: -A news/54.bugfix -M plone/app/contentmenu/menu.py +A news/58.bugfix +M plone/releaser/buildout.py +M plone/releaser/pip.py +M plone/releaser/tests/test_buildout.py +M plone/releaser/tests/test_pip.py -b'diff --git a/news/54.bugfix b/news/54.bugfix\nnew file mode 100644\nindex 0000000..25e2bd2\n--- /dev/null\n+++ b/news/54.bugfix\n@@ -0,0 +1 @@\n+Fix "Add item to default page" modal form. [sverbois]\ndiff --git a/plone/app/contentmenu/menu.py b/plone/app/contentmenu/menu.py\nindex c2dc48e..e752899 100644\n--- a/plone/app/contentmenu/menu.py\n+++ b/plone/app/contentmenu/menu.py\n@@ -711,6 +711,9 @@ def getMenuItems(self, context, request):\n "id": "plone-contentmenu-add-to-default-page",\n "separator": None,\n "class": "pat-plone-modal",\n+ "modal": json.dumps(\n+ {"actionOptions": {"disableAjaxFormSubmit": True}}\n+ ),\n },\n "submenu": None,\n }\n' +b'diff --git a/news/58.bugfix b/news/58.bugfix\nnew file mode 100644\nindex 0000000..c7b35cc\n--- /dev/null\n+++ b/news/58.bugfix\n@@ -0,0 +1,3 @@\n+Fix setting version for non-lowercase package.\n+In the previous release this would add a duplicate line.\n+[maurits]\ndiff --git a/plone/releaser/buildout.py b/plone/releaser/buildout.py\nindex b1fca5c..15db5af 100644\n--- a/plone/releaser/buildout.py\n+++ b/plone/releaser/buildout.py\n@@ -99,7 +99,8 @@ def __setitem__(self, package_name, new_version):\n self.path.write_text(contents)\n \n newline = f"{package_name} = {new_version}"\n- line_reg = re.compile(rf"^{package_name.lower()} *=.*")\n+ # Search case insensitively.\n+ line_reg = re.compile(rf"^{package_name} *=.*", flags=re.I)\n \n def line_check(line):\n # Look for the \'package name = version\' on a line of its own,\ndiff --git a/plone/releaser/pip.py b/plone/releaser/pip.py\nindex 9e59b43..2c8cb95 100644\n--- a/plone/releaser/pip.py\n+++ b/plone/releaser/pip.py\n@@ -57,7 +57,7 @@ def __setitem__(self, package_name, new_version):\n newline = f"{package_name}=={new_version}"\n # Look for \'package name==version\' on a line of its own,\n # no whitespace, no environment markers.\n- line_reg = re.compile(rf"^{package_name.lower()}==[^;]*$")\n+ line_reg = re.compile(rf"^{package_name}==[^;]*$", flags=re.I)\n \n def line_check(line):\n return line_reg.match(line)\ndiff --git a/plone/releaser/tests/test_buildout.py b/plone/releaser/tests/test_buildout.py\nindex eb479e8..b231fbc 100644\n--- a/plone/releaser/tests/test_buildout.py\n+++ b/plone/releaser/tests/test_buildout.py\n@@ -236,6 +236,19 @@ def test_versions_file_set_normal(tmp_path):\n vf["package"] = "3.0"\n vf = VersionsFile(copy_path)\n assert vf.get("package") == "3.0"\n+ # How about packages that are not lowercase?\n+ # ConfigParser reports all package names as lower case, so we don\'t know\n+ # what their exact spelling is. So whatever we pass on, should be used.\n+ assert "CamelCase = 1.0" in copy_path.read_text()\n+ assert copy_path.read_text().lower().count("camelcase") == 1\n+ vf["CAMELcase"] = "1.1"\n+ vf = VersionsFile(copy_path)\n+ assert vf["camelCASE"] == "1.1"\n+ assert vf["CaMeLcAsE"] == "1.1"\n+ text = copy_path.read_text()\n+ assert "CamelCase = 1.0" not in text\n+ assert "CAMELcase = 1.1" in text\n+ assert copy_path.read_text().lower().count("camelcase") == 1\n \n \n def test_versions_file_set_ignore_markers(tmp_path):\ndiff --git a/plone/releaser/tests/test_pip.py b/plone/releaser/tests/test_pip.py\nindex 5e256bf..30774c1 100644\n--- a/plone/releaser/tests/test_pip.py\n+++ b/plone/releaser/tests/test_pip.py\n@@ -158,6 +158,20 @@ def test_constraints_file_set_normal(tmp_path):\n cf["package"] = "3.0"\n cf = ConstraintsFile(copy_path)\n assert cf.get("package") == "3.0"\n+ # How about packages that are not lowercase?\n+ # Currently in ConstraintsFile we report all package names as lower case,\n+ # so we don\'t know what their exact spelling is, which is what ConfigParser\n+ # does for the Buildout versions file. So whatever we pass on, should be used.\n+ assert "CamelCase==1.0" in copy_path.read_text()\n+ assert copy_path.read_text().lower().count("camelcase") == 1\n+ cf["CAMELcase"] = "1.1"\n+ cf = ConstraintsFile(copy_path)\n+ assert cf["camelCASE"] == "1.1"\n+ assert cf["CaMeLcAsE"] == "1.1"\n+ text = copy_path.read_text()\n+ assert "CamelCase==1.0" not in text\n+ assert "CAMELcase==1.1" in text\n+ assert copy_path.read_text().lower().count("camelcase") == 1\n \n \n def test_constraints_file_set_ignore_markers(tmp_path):\n' -Repository: plone.app.contentmenu +Repository: plone.releaser Branch: refs/heads/master -Date: 2023-09-14T02:33:10+02:00 +Date: 2023-09-14T21:35:41+02:00 Author: Maurits van Rees (mauritsvanrees) -Commit: https://github.com/plone/plone.app.contentmenu/commit/3cc72611dcf32abaf1928436d0804d00f23f525c +Commit: https://github.com/plone/plone.releaser/commit/b84d36349554a6b6f6ee2767fb6ae34551f43186 -Merge pull request #55 from plone/issue-54 +Merge pull request #59 from plone/maurits-issue-58-lower-case -Fix #54 : "Add item to default page" modal form +Fix setting version for non-lowercase package. Files changed: -A news/54.bugfix -M plone/app/contentmenu/menu.py +A news/58.bugfix +M plone/releaser/buildout.py +M plone/releaser/pip.py +M plone/releaser/tests/test_buildout.py +M plone/releaser/tests/test_pip.py -b'diff --git a/news/54.bugfix b/news/54.bugfix\nnew file mode 100644\nindex 0000000..25e2bd2\n--- /dev/null\n+++ b/news/54.bugfix\n@@ -0,0 +1 @@\n+Fix "Add item to default page" modal form. [sverbois]\ndiff --git a/plone/app/contentmenu/menu.py b/plone/app/contentmenu/menu.py\nindex c2dc48e..e752899 100644\n--- a/plone/app/contentmenu/menu.py\n+++ b/plone/app/contentmenu/menu.py\n@@ -711,6 +711,9 @@ def getMenuItems(self, context, request):\n "id": "plone-contentmenu-add-to-default-page",\n "separator": None,\n "class": "pat-plone-modal",\n+ "modal": json.dumps(\n+ {"actionOptions": {"disableAjaxFormSubmit": True}}\n+ ),\n },\n "submenu": None,\n }\n' +b'diff --git a/news/58.bugfix b/news/58.bugfix\nnew file mode 100644\nindex 0000000..c7b35cc\n--- /dev/null\n+++ b/news/58.bugfix\n@@ -0,0 +1,3 @@\n+Fix setting version for non-lowercase package.\n+In the previous release this would add a duplicate line.\n+[maurits]\ndiff --git a/plone/releaser/buildout.py b/plone/releaser/buildout.py\nindex b1fca5c..15db5af 100644\n--- a/plone/releaser/buildout.py\n+++ b/plone/releaser/buildout.py\n@@ -99,7 +99,8 @@ def __setitem__(self, package_name, new_version):\n self.path.write_text(contents)\n \n newline = f"{package_name} = {new_version}"\n- line_reg = re.compile(rf"^{package_name.lower()} *=.*")\n+ # Search case insensitively.\n+ line_reg = re.compile(rf"^{package_name} *=.*", flags=re.I)\n \n def line_check(line):\n # Look for the \'package name = version\' on a line of its own,\ndiff --git a/plone/releaser/pip.py b/plone/releaser/pip.py\nindex 9e59b43..2c8cb95 100644\n--- a/plone/releaser/pip.py\n+++ b/plone/releaser/pip.py\n@@ -57,7 +57,7 @@ def __setitem__(self, package_name, new_version):\n newline = f"{package_name}=={new_version}"\n # Look for \'package name==version\' on a line of its own,\n # no whitespace, no environment markers.\n- line_reg = re.compile(rf"^{package_name.lower()}==[^;]*$")\n+ line_reg = re.compile(rf"^{package_name}==[^;]*$", flags=re.I)\n \n def line_check(line):\n return line_reg.match(line)\ndiff --git a/plone/releaser/tests/test_buildout.py b/plone/releaser/tests/test_buildout.py\nindex eb479e8..b231fbc 100644\n--- a/plone/releaser/tests/test_buildout.py\n+++ b/plone/releaser/tests/test_buildout.py\n@@ -236,6 +236,19 @@ def test_versions_file_set_normal(tmp_path):\n vf["package"] = "3.0"\n vf = VersionsFile(copy_path)\n assert vf.get("package") == "3.0"\n+ # How about packages that are not lowercase?\n+ # ConfigParser reports all package names as lower case, so we don\'t know\n+ # what their exact spelling is. So whatever we pass on, should be used.\n+ assert "CamelCase = 1.0" in copy_path.read_text()\n+ assert copy_path.read_text().lower().count("camelcase") == 1\n+ vf["CAMELcase"] = "1.1"\n+ vf = VersionsFile(copy_path)\n+ assert vf["camelCASE"] == "1.1"\n+ assert vf["CaMeLcAsE"] == "1.1"\n+ text = copy_path.read_text()\n+ assert "CamelCase = 1.0" not in text\n+ assert "CAMELcase = 1.1" in text\n+ assert copy_path.read_text().lower().count("camelcase") == 1\n \n \n def test_versions_file_set_ignore_markers(tmp_path):\ndiff --git a/plone/releaser/tests/test_pip.py b/plone/releaser/tests/test_pip.py\nindex 5e256bf..30774c1 100644\n--- a/plone/releaser/tests/test_pip.py\n+++ b/plone/releaser/tests/test_pip.py\n@@ -158,6 +158,20 @@ def test_constraints_file_set_normal(tmp_path):\n cf["package"] = "3.0"\n cf = ConstraintsFile(copy_path)\n assert cf.get("package") == "3.0"\n+ # How about packages that are not lowercase?\n+ # Currently in ConstraintsFile we report all package names as lower case,\n+ # so we don\'t know what their exact spelling is, which is what ConfigParser\n+ # does for the Buildout versions file. So whatever we pass on, should be used.\n+ assert "CamelCase==1.0" in copy_path.read_text()\n+ assert copy_path.read_text().lower().count("camelcase") == 1\n+ cf["CAMELcase"] = "1.1"\n+ cf = ConstraintsFile(copy_path)\n+ assert cf["camelCASE"] == "1.1"\n+ assert cf["CaMeLcAsE"] == "1.1"\n+ text = copy_path.read_text()\n+ assert "CamelCase==1.0" not in text\n+ assert "CAMELcase==1.1" in text\n+ assert copy_path.read_text().lower().count("camelcase") == 1\n \n \n def test_constraints_file_set_ignore_markers(tmp_path):\n'