Skip to content

Commit

Permalink
[fc] Repository: plone.restapi
Browse files Browse the repository at this point in the history
Branch: refs/heads/main
Date: 2025-01-27T20:21:28-08:00
Author: David Glick (davisagli) <[email protected]>
Commit: plone/plone.restapi@d4573a4

Preparing release 9.10.0

Files changed:
M CHANGES.rst
M setup.py
D news/1685.internal
D news/1757.feature
D news/1855.bugfix
D news/1857.bugfix
D news/1858.bugfix
D news/1861.feature
D news/1864.bugfix
D news/1867.bugfix
D news/4090.bugfix
Repository: plone.restapi

Branch: refs/heads/main
Date: 2025-01-27T20:22:19-08:00
Author: David Glick (davisagli) <[email protected]>
Commit: plone/plone.restapi@0a2f821

Back to development: 9.10.1

Files changed:
M setup.py
  • Loading branch information
davisagli committed Jan 28, 2025
1 parent 708e235 commit 4a26835
Showing 1 changed file with 32 additions and 21 deletions.
53 changes: 32 additions & 21 deletions last_commit.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,39 @@ Repository: plone.restapi


Branch: refs/heads/main
Date: 2025-01-27T08:48:48-08:00
Author: Mauro Amico (mamico) <[email protected]>
Commit: https://github.com/plone/plone.restapi/commit/3830080c59daf497880046022521ab8cdb10ee7a

AttributeError occurs in creator_name when the user is missing (#1867)

* AttributeError occurs in creator_name when the user is missing

* changelog

* userid

* Update news/1867.bugfix

---------

Co-authored-by: David Glick &lt;[email protected]&gt;
Date: 2025-01-27T20:21:28-08:00
Author: David Glick (davisagli) <[email protected]>
Commit: https://github.com/plone/plone.restapi/commit/d4573a40fed74f2cafee501810b2ecf7aae17d8c

Preparing release 9.10.0

Files changed:
M CHANGES.rst
M setup.py
D news/1685.internal
D news/1757.feature
D news/1855.bugfix
D news/1857.bugfix
D news/1858.bugfix
D news/1861.feature
D news/1864.bugfix
D news/1867.bugfix
D news/4090.bugfix

b'diff --git a/CHANGES.rst b/CHANGES.rst\nindex ea84b6bbac..635a491e90 100644\n--- a/CHANGES.rst\n+++ b/CHANGES.rst\n@@ -8,6 +8,33 @@ Changelog\n \n .. towncrier release notes start\n \n+9.10.0 (2025-01-27)\n+-------------------\n+\n+New features:\n+\n+\n+- Add a `@login` endpoint to get external login services\' links. @erral (#1757)\n+- In the `@registry` endpoint, added support for filtering the list of registry records. @Faakhir30 (#1861)\n+\n+\n+Bug fixes:\n+\n+\n+- Changed bad int inputs into 500 Exceptions to 400 BadRequest so they can be filtered out of logs more easily. @djay (#1855)\n+- Handle TypeError on querystringsearch as BadRequest. @djay (#1857)\n+- Add parse_int to handle all cases of BadRequests from ints passed in. @djay (#1858)\n+- In the `@contextnavigation` endpoint, return `"icon": null` for Files with a mimetype not found in the `content_type_registry`, instead of raising `TypeError`. @mamico (#1864)\n+- In the `@locking` endpoint, fixed edge cases where the user who owns the lock was not found correctly. @mamico (#1867)\n+- Prevent deprecation warnings. @mauritsvanrees (#4090)\n+\n+\n+Internal:\n+\n+\n+- Update CI. @davisagli (#1685)\n+\n+\n 9.9.0 (2024-12-18)\n ------------------\n \ndiff --git a/news/1685.internal b/news/1685.internal\ndeleted file mode 100644\nindex 6fe9f0e0dc..0000000000\n--- a/news/1685.internal\n+++ /dev/null\n@@ -1 +0,0 @@\n-Update CI. @davisagli\ndiff --git a/news/1757.feature b/news/1757.feature\ndeleted file mode 100644\nindex c678441b4e..0000000000\n--- a/news/1757.feature\n+++ /dev/null\n@@ -1 +0,0 @@\n-Add a `@login` endpoint to get external login services\' links. @erral\ndiff --git a/news/1855.bugfix b/news/1855.bugfix\ndeleted file mode 100644\nindex b164e9f037..0000000000\n--- a/news/1855.bugfix\n+++ /dev/null\n@@ -1 +0,0 @@\n-Changed bad int inputs into 500 Exceptions to 400 BadRequest so they can be filtered out of logs more easily. @djay\n\\ No newline at end of file\ndiff --git a/news/1857.bugfix b/news/1857.bugfix\ndeleted file mode 100644\nindex ea4ba7b398..0000000000\n--- a/news/1857.bugfix\n+++ /dev/null\n@@ -1 +0,0 @@\n-Handle TypeError on querystringsearch as BadRequest. @djay\n\\ No newline at end of file\ndiff --git a/news/1858.bugfix b/news/1858.bugfix\ndeleted file mode 100644\nindex b275567243..0000000000\n--- a/news/1858.bugfix\n+++ /dev/null\n@@ -1 +0,0 @@\n-Add parse_int to handle all cases of BadRequests from ints passed in. @djay\n\\ No newline at end of file\ndiff --git a/news/1861.feature b/news/1861.feature\ndeleted file mode 100644\nindex 5e3538d612..0000000000\n--- a/news/1861.feature\n+++ /dev/null\n@@ -1 +0,0 @@\n-In the `@registry` endpoint, added support for filtering the list of registry records. @Faakhir30\n\\ No newline at end of file\ndiff --git a/news/1864.bugfix b/news/1864.bugfix\ndeleted file mode 100644\nindex 9e63a64abd..0000000000\n--- a/news/1864.bugfix\n+++ /dev/null\n@@ -1 +0,0 @@\n-In the `@contextnavigation` endpoint, return `"icon": null` for Files with a mimetype not found in the `content_type_registry`, instead of raising `TypeError`. @mamico\ndiff --git a/news/1867.bugfix b/news/1867.bugfix\ndeleted file mode 100644\nindex f4ddcaac89..0000000000\n--- a/news/1867.bugfix\n+++ /dev/null\n@@ -1 +0,0 @@\n-In the `@locking` endpoint, fixed edge cases where the user who owns the lock was not found correctly. @mamico\ndiff --git a/news/4090.bugfix b/news/4090.bugfix\ndeleted file mode 100644\nindex 3a0ea37c4b..0000000000\n--- a/news/4090.bugfix\n+++ /dev/null\n@@ -1 +0,0 @@\n-Prevent deprecation warnings. @mauritsvanrees\ndiff --git a/setup.py b/setup.py\nindex 15942cd754..f5db188605 100644\n--- a/setup.py\n+++ b/setup.py\n@@ -4,7 +4,7 @@\n import sys\n \n \n-version = "9.9.1.dev0"\n+version = "9.10.0"\n \n if sys.version_info.major == 2:\n raise ValueError(\n'

Repository: plone.restapi


Branch: refs/heads/main
Date: 2025-01-27T20:22:19-08:00
Author: David Glick (davisagli) <[email protected]>
Commit: https://github.com/plone/plone.restapi/commit/0a2f821690898c14cd2ceddd372088f748671ccd

Back to development: 9.10.1

Files changed:
A news/1867.bugfix
M src/plone/restapi/services/locking/__init__.py
M src/plone/restapi/tests/test_locking.py
M setup.py

b'diff --git a/news/1867.bugfix b/news/1867.bugfix\nnew file mode 100644\nindex 000000000..f4ddcaac8\n--- /dev/null\n+++ b/news/1867.bugfix\n@@ -0,0 +1 @@\n+In the `@locking` endpoint, fixed edge cases where the user who owns the lock was not found correctly. @mamico\ndiff --git a/src/plone/restapi/services/locking/__init__.py b/src/plone/restapi/services/locking/__init__.py\nindex 1b22e975a..c9347a7b4 100644\n--- a/src/plone/restapi/services/locking/__init__.py\n+++ b/src/plone/restapi/services/locking/__init__.py\n@@ -7,14 +7,17 @@\n from plone.locking.interfaces import ILockable\n \n \n-def creator_name(username):\n- user = api.user.get(username=username)\n- return user.getProperty("fullname") or username\n+def creator_name(userid):\n+ user = api.user.get(userid=userid)\n+ if user:\n+ return user.getProperty("fullname") or userid\n+ else:\n+ return userid\n \n \n-def creator_url(username):\n+def creator_url(userid):\n url = api.portal.get().absolute_url()\n- return f"{url}/author/{username}"\n+ return f"{url}/author/{userid}"\n \n \n def creation_date(timestamp):\ndiff --git a/src/plone/restapi/tests/test_locking.py b/src/plone/restapi/tests/test_locking.py\nindex 191b4d6bd..40e7fc5b8 100644\n--- a/src/plone/restapi/tests/test_locking.py\n+++ b/src/plone/restapi/tests/test_locking.py\n@@ -1,3 +1,4 @@\n+from plone import api\n from plone.app.testing import login\n from plone.app.testing import SITE_OWNER_NAME\n from plone.app.testing import SITE_OWNER_PASSWORD\n@@ -112,3 +113,45 @@ def test_update_locked_object_with_token_succeeds(self):\n transaction.commit()\n self.assertEqual(response.status_code, 204)\n self.assertEqual(self.doc.Title(), "New Title")\n+\n+ def test_lock_user_removed(self):\n+ lockable = ILockable(self.doc)\n+ api.user.create(\n+ username="foo",\n+ email="[email protected]",\n+ roles=["Manager"],\n+ )\n+ with api.env.adopt_user(username="foo"):\n+ lockable.lock()\n+ api.user.delete(username="foo")\n+ transaction.commit()\n+ # the user that locked the object is no longer present\n+ response = self.api_session.get("/@lock")\n+ self.assertEqual(response.status_code, 200)\n+ self.assertEqual(response.json()["creator"], "foo")\n+ self.assertEqual(response.json()["creator_name"], "foo")\n+ self.assertTrue(lockable.locked())\n+\n+ def test_lock_username_vs_userid(self):\n+ lockable = ILockable(self.doc)\n+ api.user.create(\n+ username="foo1234",\n+ email="[email protected]",\n+ roles=["Manager"],\n+ properties={"fullname": "Foo Bar"},\n+ )\n+ pas = api.portal.get_tool("acl_users")\n+ # generally the username and userid are the same...\n+ self.assertEqual(pas.getUserById("foo1234").getUserName(), "foo1234")\n+ # ...but we can change it\n+ pas.updateLoginName("foo1234", "foo")\n+ self.assertEqual(pas.getUserById("foo1234").getUserName(), "foo")\n+ with api.env.adopt_user(username="foo"):\n+ lockable.lock()\n+ transaction.commit()\n+ response = self.api_session.get("/@lock")\n+ self.assertEqual(response.status_code, 200)\n+ # here the userid\n+ self.assertEqual(response.json()["creator"], "foo1234")\n+ self.assertEqual(response.json()["creator_name"], "Foo Bar")\n+ self.assertTrue(lockable.locked())\n'
b'diff --git a/setup.py b/setup.py\nindex f5db18860..c0ba91e1a 100644\n--- a/setup.py\n+++ b/setup.py\n@@ -4,7 +4,7 @@\n import sys\n \n \n-version = "9.10.0"\n+version = "9.10.1.dev0"\n \n if sys.version_info.major == 2:\n raise ValueError(\n'

0 comments on commit 4a26835

Please sign in to comment.