-
-
Notifications
You must be signed in to change notification settings - Fork 74
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Branch: refs/heads/master Date: 2025-01-06T17:20:28+01:00 Author: Godefroid Chapelle (gotcha) <[email protected]> Commit: plone/Products.CMFPlone@8131699 Update python-requires Has been missed in plone/Products.CMFPlone@eba6e73 Files changed: M setup.py Repository: Products.CMFPlone Branch: refs/heads/master Date: 2025-01-06T21:25:18+01:00 Author: Maurits van Rees (mauritsvanrees) <[email protected]> Commit: plone/Products.CMFPlone@0d9943c Merge pull request #4087 from plone/gotcha/fix-python-requires Update python-requires Files changed: M setup.py
- Loading branch information
1 parent
ea8dc4c
commit 9e7f815
Showing
1 changed file
with
18 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,50 +1,34 @@ | ||
Repository: plone.api | ||
Repository: Products.CMFPlone | ||
|
||
|
||
Branch: refs/heads/main | ||
Date: 2024-12-20T06:52:47+01:00 | ||
Author: Philip Bauer (pbauer) <[email protected]> | ||
Commit: https://github.com/plone/plone.api/commit/0da4d7050953c7b513e1787dad05c64b09bdd556 | ||
Branch: refs/heads/master | ||
Date: 2025-01-06T17:20:28+01:00 | ||
Author: Godefroid Chapelle (gotcha) <[email protected]> | ||
Commit: https://github.com/plone/Products.CMFPlone/commit/81316998219cc2828a651b8ed132c37ed60064b1 | ||
|
||
Fix api.content.get when a item in the path is not accessible to the user (#549) | ||
Update python-requires | ||
|
||
Files changed: | ||
A news/549.bugfix | ||
M src/plone/api/content.py | ||
|
||
b'diff --git a/news/549.bugfix b/news/549.bugfix\nnew file mode 100644\nindex 00000000..2d2d3666\n--- /dev/null\n+++ b/news/549.bugfix\n@@ -0,0 +1,2 @@\n+Fix api.content.get(path=path) when a item in the path is not accessible to the user.\n+[pbauer]\ndiff --git a/src/plone/api/content.py b/src/plone/api/content.py\nindex 95515de9..f0a9c850 100644\n--- a/src/plone/api/content.py\n+++ b/src/plone/api/content.py\n@@ -133,7 +133,12 @@ def get(path=None, UID=None):\n relative_path=path,\n )\n try:\n- content = site.restrictedTraverse(path)\n+ path = path.split("/")\n+ if len(path) > 1:\n+ parent = site.unrestrictedTraverse(path[:-1])\n+ content = parent.restrictedTraverse(path[-1])\n+ else:\n+ content = site.restrictedTraverse(path[-1])\n except (KeyError, AttributeError):\n return None # When no object is found don\'t raise an error\n else:\n' | ||
|
||
Repository: plone.api | ||
|
||
|
||
Branch: refs/heads/main | ||
Date: 2024-12-20T08:19:24+01:00 | ||
Author: Philip Bauer (pbauer) <[email protected]> | ||
Commit: https://github.com/plone/plone.api/commit/c6cfdb41b5e7bc9f1ca518f1e3449059d4820aae | ||
|
||
add test | ||
Has been missed in https://github.com/plone/Products.CMFPlone/commit/eba6e73108541efac28eef47c7be61c658684db9 | ||
|
||
Files changed: | ||
M src/plone/api/tests/test_content.py | ||
M setup.py | ||
|
||
b'diff --git a/src/plone/api/tests/test_content.py b/src/plone/api/tests/test_content.py\nindex 41caebc0..4e9b701b 100644\n--- a/src/plone/api/tests/test_content.py\n+++ b/src/plone/api/tests/test_content.py\n@@ -478,6 +478,16 @@ def test_get(self):\n # title is an attribute\n self.assertIsNone(api.content.get("/about/team/title"))\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+ with api.env.adopt_roles(["Member"]):\n+ team_by_path = api.content.get("/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' | ||
b'diff --git a/setup.py b/setup.py\nindex f5c535c6b6..9bdb79606d 100644\n--- a/setup.py\n+++ b/setup.py\n@@ -26,7 +26,7 @@\n "Programming Language :: Python :: 3.12",\n "Programming Language :: Python :: 3.13",\n ],\n- python_requires=">=3.8",\n+ python_requires=">=3.10",\n keywords="Plone CMF Python Zope CMS Webapplication",\n author="Plone Foundation",\n author_email="[email protected]",\n' | ||
|
||
Repository: plone.api | ||
Repository: Products.CMFPlone | ||
|
||
|
||
Branch: refs/heads/main | ||
Date: 2024-12-21T21:52:17+01:00 | ||
Author: Philip Bauer (pbauer) <[email protected]> | ||
Commit: https://github.com/plone/plone.api/commit/ef012878006d89efc37321082610be85c1d162be | ||
Branch: refs/heads/master | ||
Date: 2025-01-06T21:25:18+01:00 | ||
Author: Maurits van Rees (mauritsvanrees) <[email protected]> | ||
Commit: https://github.com/plone/Products.CMFPlone/commit/0d9943cc7465281ca19b361635bf1836c59a0455 | ||
|
||
Merge pull request #550 from plone/fix_getting_content_in_inaccessible_containers | ||
Merge pull request #4087 from plone/gotcha/fix-python-requires | ||
|
||
Fix api.content.get when a item in the path is not acccessible | ||
Update python-requires | ||
|
||
Files changed: | ||
A news/549.bugfix | ||
M src/plone/api/content.py | ||
M src/plone/api/tests/test_content.py | ||
M setup.py | ||
|
||
b'diff --git a/news/549.bugfix b/news/549.bugfix\nnew file mode 100644\nindex 00000000..2d2d3666\n--- /dev/null\n+++ b/news/549.bugfix\n@@ -0,0 +1,2 @@\n+Fix api.content.get(path=path) when a item in the path is not accessible to the user.\n+[pbauer]\ndiff --git a/src/plone/api/content.py b/src/plone/api/content.py\nindex 95515de9..f0a9c850 100644\n--- a/src/plone/api/content.py\n+++ b/src/plone/api/content.py\n@@ -133,7 +133,12 @@ def get(path=None, UID=None):\n relative_path=path,\n )\n try:\n- content = site.restrictedTraverse(path)\n+ path = path.split("/")\n+ if len(path) > 1:\n+ parent = site.unrestrictedTraverse(path[:-1])\n+ content = parent.restrictedTraverse(path[-1])\n+ else:\n+ content = site.restrictedTraverse(path[-1])\n except (KeyError, AttributeError):\n return None # When no object is found don\'t raise an error\n else:\ndiff --git a/src/plone/api/tests/test_content.py b/src/plone/api/tests/test_content.py\nindex 41caebc0..4e9b701b 100644\n--- a/src/plone/api/tests/test_content.py\n+++ b/src/plone/api/tests/test_content.py\n@@ -478,6 +478,16 @@ def test_get(self):\n # title is an attribute\n self.assertIsNone(api.content.get("/about/team/title"))\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+ with api.env.adopt_roles(["Member"]):\n+ team_by_path = api.content.get("/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' | ||
b'diff --git a/setup.py b/setup.py\nindex f5c535c6b6..9bdb79606d 100644\n--- a/setup.py\n+++ b/setup.py\n@@ -26,7 +26,7 @@\n "Programming Language :: Python :: 3.12",\n "Programming Language :: Python :: 3.13",\n ],\n- python_requires=">=3.8",\n+ python_requires=">=3.10",\n keywords="Plone CMF Python Zope CMS Webapplication",\n author="Plone Foundation",\n author_email="[email protected]",\n' | ||
|