diff --git a/last_commit.txt b/last_commit.txt index abec4d24a0..5c0f8385a4 100644 --- a/last_commit.txt +++ b/last_commit.txt @@ -1,48 +1,50 @@ -Repository: collective.monkeypatcher +Repository: plone.api -Branch: refs/heads/master -Date: 2024-11-27T15:11:02-03:00 -Author: Peter Mathis (petschki) -Commit: https://github.com/plone/collective.monkeypatcher/commit/8c5a3ddc436f6a0c10e62564ca3788d9cdf373f9 +Branch: refs/heads/1.x +Date: 2024-12-20T09:15:14+01:00 +Author: Philip Bauer (pbauer) +Commit: https://github.com/plone/plone.api/commit/c8abe540c53b965ba776a30c8959809dc0b09e1a -remove deprecated unittest.makeSuite +backport fix for #549 Files changed: -M src/collective/monkeypatcher/tests/test_monkeypatcher.py +M src/plone/api/content.py +M src/plone/api/tests/test_content.py -b'diff --git a/src/collective/monkeypatcher/tests/test_monkeypatcher.py b/src/collective/monkeypatcher/tests/test_monkeypatcher.py\nindex fec3dff..30a7c8f 100644\n--- a/src/collective/monkeypatcher/tests/test_monkeypatcher.py\n+++ b/src/collective/monkeypatcher/tests/test_monkeypatcher.py\n@@ -67,7 +67,8 @@ def test_monkeyPatchEvent(self):\n \n \n def test_suite():\n- from unittest import TestSuite, makeSuite\n- suite = TestSuite()\n- suite.addTest(makeSuite(TestMonkeyPatcher))\n- return suite\n+ import unittest\n+\n+ return unittest.TestSuite((\n+ unittest.defaultTestLoader.loadTestsFromTestCase(TestMonkeyPatcher),\n+ ))\n' +b'diff --git a/src/plone/api/content.py b/src/plone/api/content.py\nindex 1f520a17..d6652d4c 100644\n--- a/src/plone/api/content.py\n+++ b/src/plone/api/content.py\n@@ -157,7 +157,12 @@ def get(path=None, UID=None):\n )\n \n try:\n- return site.restrictedTraverse(path)\n+ path = path.split(\'/\')\n+ if len(path) > 1:\n+ parent = site.unrestrictedTraverse(path[:-1])\n+ return parent.restrictedTraverse(path[-1])\n+ else:\n+ return site.restrictedTraverse(path[-1])\n except (KeyError, AttributeError):\n return None # When no object is found don\'t raise an error\n \ndiff --git a/src/plone/api/tests/test_content.py b/src/plone/api/tests/test_content.py\nindex 1332d7d5..f353f7a9 100644\n--- a/src/plone/api/tests/test_content.py\n+++ b/src/plone/api/tests/test_content.py\n@@ -505,6 +505,17 @@ def test_get(self):\n # Test getting a non-existing subfolder by path\n self.assertFalse(api.content.get(\'/about/spam\'))\n \n+ def test_get_of_content_in_inaccessible_container(self):\n+ """Test getting items in a inaccessible container.\n+ Worked in Plone 5.1 but raised Unauthorized since 5.2."""\n+ api.content.transition(obj=self.team, transition=\'publish\')\n+ team_by_path = api.content.get(path=\'/about/team\')\n+ with api.env.adopt_roles([\'Member\']):\n+ team_by_path = api.content.get(path=\'/about/team\')\n+ self.assertEqual(self.team, team_by_path)\n+ team_by_uid = api.content.get(UID=self.team.UID())\n+ self.assertEqual(self.team, team_by_uid)\n+\n def test_move_constraints(self):\n """Test the constraints for moving content."""\n from plone.api.exc import MissingParameterError\n' -Repository: collective.monkeypatcher +Repository: plone.api -Branch: refs/heads/master -Date: 2024-11-27T15:12:13-03:00 -Author: Peter Mathis (petschki) -Commit: https://github.com/plone/collective.monkeypatcher/commit/dd64846474ae56e32d1be52d2e24c228a18af032 +Branch: refs/heads/1.x +Date: 2024-12-20T09:16:49+01:00 +Author: Philip Bauer (pbauer) +Commit: https://github.com/plone/plone.api/commit/8ca6c9e865b6b193b7c342c32c0918a26244d411 -changenote +add news Files changed: -A news/14.bugfix +A news/551.bugfix -b'diff --git a/news/14.bugfix b/news/14.bugfix\nnew file mode 100644\nindex 0000000..41e6fd2\n--- /dev/null\n+++ b/news/14.bugfix\n@@ -0,0 +1,2 @@\n+Fix removed `unittest.makeSuite` in python 3.13.\n+[petschki]\n' +b'diff --git a/news/551.bugfix b/news/551.bugfix\nnew file mode 100644\nindex 00000000..593ab355\n--- /dev/null\n+++ b/news/551.bugfix\n@@ -0,0 +1,2 @@\n+Backport fix for #549\n+[pbauer]\n' -Repository: collective.monkeypatcher +Repository: plone.api -Branch: refs/heads/master -Date: 2024-11-28T22:48:09-03:00 -Author: Peter Mathis (petschki) -Commit: https://github.com/plone/collective.monkeypatcher/commit/b68bd2bca30c5d7b4b9d192c40fd06c0d64a431d +Branch: refs/heads/1.x +Date: 2024-12-21T21:52:23+01:00 +Author: Philip Bauer (pbauer) +Commit: https://github.com/plone/plone.api/commit/212bb72f78a03d7f84ba209c37c05c56c1317f7f -Merge pull request #14 from plone/py-3.13-unittest +Merge pull request #551 from plone/backport_549 -Fix removed `unittest.makeSuite` in py 3.13 + backport fix for #549 Files changed: -A news/14.bugfix -M src/collective/monkeypatcher/tests/test_monkeypatcher.py +A news/551.bugfix +M src/plone/api/content.py +M src/plone/api/tests/test_content.py -b'diff --git a/news/14.bugfix b/news/14.bugfix\nnew file mode 100644\nindex 0000000..41e6fd2\n--- /dev/null\n+++ b/news/14.bugfix\n@@ -0,0 +1,2 @@\n+Fix removed `unittest.makeSuite` in python 3.13.\n+[petschki]\ndiff --git a/src/collective/monkeypatcher/tests/test_monkeypatcher.py b/src/collective/monkeypatcher/tests/test_monkeypatcher.py\nindex fec3dff..30a7c8f 100644\n--- a/src/collective/monkeypatcher/tests/test_monkeypatcher.py\n+++ b/src/collective/monkeypatcher/tests/test_monkeypatcher.py\n@@ -67,7 +67,8 @@ def test_monkeyPatchEvent(self):\n \n \n def test_suite():\n- from unittest import TestSuite, makeSuite\n- suite = TestSuite()\n- suite.addTest(makeSuite(TestMonkeyPatcher))\n- return suite\n+ import unittest\n+\n+ return unittest.TestSuite((\n+ unittest.defaultTestLoader.loadTestsFromTestCase(TestMonkeyPatcher),\n+ ))\n' +b'diff --git a/news/551.bugfix b/news/551.bugfix\nnew file mode 100644\nindex 00000000..593ab355\n--- /dev/null\n+++ b/news/551.bugfix\n@@ -0,0 +1,2 @@\n+Backport fix for #549\n+[pbauer]\ndiff --git a/src/plone/api/content.py b/src/plone/api/content.py\nindex 1f520a17..d6652d4c 100644\n--- a/src/plone/api/content.py\n+++ b/src/plone/api/content.py\n@@ -157,7 +157,12 @@ def get(path=None, UID=None):\n )\n \n try:\n- return site.restrictedTraverse(path)\n+ path = path.split(\'/\')\n+ if len(path) > 1:\n+ parent = site.unrestrictedTraverse(path[:-1])\n+ return parent.restrictedTraverse(path[-1])\n+ else:\n+ return site.restrictedTraverse(path[-1])\n except (KeyError, AttributeError):\n return None # When no object is found don\'t raise an error\n \ndiff --git a/src/plone/api/tests/test_content.py b/src/plone/api/tests/test_content.py\nindex 1332d7d5..f353f7a9 100644\n--- a/src/plone/api/tests/test_content.py\n+++ b/src/plone/api/tests/test_content.py\n@@ -505,6 +505,17 @@ def test_get(self):\n # Test getting a non-existing subfolder by path\n self.assertFalse(api.content.get(\'/about/spam\'))\n \n+ def test_get_of_content_in_inaccessible_container(self):\n+ """Test getting items in a inaccessible container.\n+ Worked in Plone 5.1 but raised Unauthorized since 5.2."""\n+ api.content.transition(obj=self.team, transition=\'publish\')\n+ team_by_path = api.content.get(path=\'/about/team\')\n+ with api.env.adopt_roles([\'Member\']):\n+ team_by_path = api.content.get(path=\'/about/team\')\n+ self.assertEqual(self.team, team_by_path)\n+ team_by_uid = api.content.get(UID=self.team.UID())\n+ self.assertEqual(self.team, team_by_uid)\n+\n def test_move_constraints(self):\n """Test the constraints for moving content."""\n from plone.api.exc import MissingParameterError\n'