From 10667da4409fc8b180d639302f24889964381785 Mon Sep 17 00:00:00 2001 From: jensens Date: Tue, 14 Sep 2021 09:09:43 +0200 Subject: [PATCH] [fc] Repository: Products.CMFPlone Branch: refs/heads/master Date: 2021-09-13T12:20:58+02:00 Author: Maurits van Rees (mauritsvanrees) Commit: https://github.com/plone/Products.CMFPlone/commit/b9db2df54afe16fdcf149fb0d2aeb1d4b18659ef Add plone.app.caching to the list of add-ons that is upgraded when upgrading Plone. In PR https://github.com/plone/plone.app.caching/pull/83 I add the first upgrade step. Files changed: A news/82.bugfix M Products/CMFPlone/MigrationTool.py Repository: Products.CMFPlone Branch: refs/heads/master Date: 2021-09-13T20:01:52+02:00 Author: Maurits van Rees (mauritsvanrees) Commit: https://github.com/plone/Products.CMFPlone/commit/85c4e7cd0dbabb792fc4a5c387c5f415e846db86 Addon list for upgrade: check if we can import non-standard packages. CMFPlacefulWorkflow, plone.app.caching, and plone.app.iterate are not dependencies of CMFPlone, but of Plone, so not all sites will have them. This avoids a GenericSetup warning. See https://github.com/plone/Products.CMFPlone/pull/3311#discussion_r707343362 Files changed: M Products/CMFPlone/MigrationTool.py Repository: Products.CMFPlone Branch: refs/heads/master Date: 2021-09-13T20:02:55+02:00 Author: Maurits van Rees (mauritsvanrees) Commit: https://github.com/plone/Products.CMFPlone/commit/1128832b34521a36eda68d95a4d54bff27e605d2 Addon list for upgrade: try to upgrade default profile of plone.app.iterate. This package at the moment still has a profile called plone.app.iterate. In 3.1.5 (used since Plone 5.0.3), the default profile was added. The old name is kept for compatibility until now, but should be removed. Perhaps this may need an upgrade step in plone.app.iterate for people who used the old name. But with the old name in the addon list, `plone.app.iterate:default` was never upgraded automatically. Files changed: M Products/CMFPlone/MigrationTool.py Repository: Products.CMFPlone Branch: refs/heads/master Date: 2021-09-14T09:09:43+02:00 Author: Jens W. Klein (jensens) Commit: https://github.com/plone/Products.CMFPlone/commit/3227b15ce36f191d573b4accb90afb0b32493581 Merge pull request #3311 from plone/maurits/plone-app-caching-in-addon-list Add plone.app.caching to list of add-ons to upgrade Files changed: A news/82.bugfix M Products/CMFPlone/MigrationTool.py --- last_commit.txt | 78 ++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 61 insertions(+), 17 deletions(-) diff --git a/last_commit.txt b/last_commit.txt index 4b42cbd2b5..d1a7671ea0 100644 --- a/last_commit.txt +++ b/last_commit.txt @@ -1,34 +1,78 @@ -Repository: plone.restapi +Repository: Products.CMFPlone Branch: refs/heads/master -Date: 2021-09-13T19:16:32+02:00 -Author: Érico Andrei (ericof) -Commit: https://github.com/plone/plone.restapi/commit/10da0d0e67691f73e25b1b50a0c294bea9d09227 +Date: 2021-09-13T12:20:58+02:00 +Author: Maurits van Rees (mauritsvanrees) +Commit: https://github.com/plone/Products.CMFPlone/commit/b9db2df54afe16fdcf149fb0d2aeb1d4b18659ef -Fix #1222: Order users by fullname. +Add plone.app.caching to the list of add-ons that is upgraded when upgrading Plone. + +In PR https://github.com/plone/plone.app.caching/pull/83 I add the first upgrade step. + +Files changed: +A news/82.bugfix +M Products/CMFPlone/MigrationTool.py + +b"diff --git a/Products/CMFPlone/MigrationTool.py b/Products/CMFPlone/MigrationTool.py\nindex a7bf17b886..67522782d8 100644\n--- a/Products/CMFPlone/MigrationTool.py\n+++ b/Products/CMFPlone/MigrationTool.py\n@@ -88,6 +88,7 @@ def upgrade_all(self, context):\n ADDON_LIST = AddonList([\n Addon(profile_id='Products.CMFEditions:CMFEditions'),\n Addon(profile_id='Products.CMFPlacefulWorkflow:CMFPlacefulWorkflow'),\n+ Addon(profile_id='plone.app.caching:default'),\n Addon(profile_id='plone.app.contenttypes:default'),\n Addon(profile_id='plone.app.dexterity:default'),\n Addon(profile_id='plone.app.discussion:default'),\ndiff --git a/news/82.bugfix b/news/82.bugfix\nnew file mode 100644\nindex 0000000000..53ab366c9b\n--- /dev/null\n+++ b/news/82.bugfix\n@@ -0,0 +1,2 @@\n+Add ``plone.app.caching`` to the list of add-ons that is upgraded when upgrading Plone.\n+[maurits]\n" + +Repository: Products.CMFPlone + + +Branch: refs/heads/master +Date: 2021-09-13T20:01:52+02:00 +Author: Maurits van Rees (mauritsvanrees) +Commit: https://github.com/plone/Products.CMFPlone/commit/85c4e7cd0dbabb792fc4a5c387c5f415e846db86 + +Addon list for upgrade: check if we can import non-standard packages. + +CMFPlacefulWorkflow, plone.app.caching, and plone.app.iterate are not dependencies of CMFPlone, +but of Plone, so not all sites will have them. +This avoids a GenericSetup warning. +See https://github.com/plone/Products.CMFPlone/pull/3311#discussion_r707343362 + +Files changed: +M Products/CMFPlone/MigrationTool.py + +b"diff --git a/Products/CMFPlone/MigrationTool.py b/Products/CMFPlone/MigrationTool.py\nindex 67522782d8..456f1d9998 100644\n--- a/Products/CMFPlone/MigrationTool.py\n+++ b/Products/CMFPlone/MigrationTool.py\n@@ -85,15 +85,26 @@ def upgrade_all(self, context):\n # List of upgradeable packages. Obvious items to add here, are all\n # core packages that actually have upgrade steps.\n # Good start is portal_setup.listProfilesWithUpgrades()\n+# Please use 'check_module' for packages that are not direct dependencies\n+# of Products.CMFPlone, but of the Plone package.\n ADDON_LIST = AddonList([\n Addon(profile_id='Products.CMFEditions:CMFEditions'),\n- Addon(profile_id='Products.CMFPlacefulWorkflow:CMFPlacefulWorkflow'),\n- Addon(profile_id='plone.app.caching:default'),\n+ Addon(\n+ profile_id='Products.CMFPlacefulWorkflow:CMFPlacefulWorkflow',\n+ check_module='Products.CMFPlacefulWorkflow'\n+ ),\n+ Addon(\n+ profile_id='plone.app.caching:default',\n+ check_module='plone.app.caching'\n+ ),\n Addon(profile_id='plone.app.contenttypes:default'),\n Addon(profile_id='plone.app.dexterity:default'),\n Addon(profile_id='plone.app.discussion:default'),\n Addon(profile_id='plone.app.event:default'),\n- Addon(profile_id='plone.app.iterate:plone.app.iterate'),\n+ Addon(\n+ profile_id='plone.app.iterate:plone.app.iterate',\n+ check_module='plone.app.iterate'\n+ ),\n Addon(profile_id='plone.app.multilingual:default'),\n Addon(profile_id='plone.app.querystring:default'),\n Addon(profile_id='plone.app.theming:default'),\n" + +Repository: Products.CMFPlone + + +Branch: refs/heads/master +Date: 2021-09-13T20:02:55+02:00 +Author: Maurits van Rees (mauritsvanrees) +Commit: https://github.com/plone/Products.CMFPlone/commit/1128832b34521a36eda68d95a4d54bff27e605d2 + +Addon list for upgrade: try to upgrade default profile of plone.app.iterate. + +This package at the moment still has a profile called plone.app.iterate. +In 3.1.5 (used since Plone 5.0.3), the default profile was added. +The old name is kept for compatibility until now, but should be removed. +Perhaps this may need an upgrade step in plone.app.iterate for people who used the old name. + +But with the old name in the addon list, `plone.app.iterate:default` was never upgraded automatically. Files changed: -A news/1222.bugfix -M src/plone/restapi/services/users/get.py +M Products/CMFPlone/MigrationTool.py -b'diff --git a/news/1222.bugfix b/news/1222.bugfix\nnew file mode 100644\nindex 000000000..1652f94f9\n--- /dev/null\n+++ b/news/1222.bugfix\n@@ -0,0 +1,2 @@\n+Fix @users endpoint to return list of users ordered by fullname property\n+[ericof]\n\\ No newline at end of file\ndiff --git a/src/plone/restapi/services/users/get.py b/src/plone/restapi/services/users/get.py\nindex cf29d5c9f..72d690731 100644\n--- a/src/plone/restapi/services/users/get.py\n+++ b/src/plone/restapi/services/users/get.py\n@@ -2,6 +2,7 @@\n from plone.restapi.interfaces import ISerializeToJson\n from plone.restapi.services import Service\n from Products.CMFCore.utils import getToolByName\n+from Products.CMFPlone.utils import normalizeString\n from zExceptions import BadRequest\n from zope.component import queryMultiAdapter\n from zope.component.hooks import getSite\n@@ -36,15 +37,25 @@ def _get_user_id(self):\n def _get_user(self, user_id):\n return self.portal_membership.getMemberById(user_id)\n \n+ @staticmethod\n+ def _sort_users(users):\n+ users.sort(\n+ key=lambda x: x is not None\n+ and normalizeString(x.getProperty("fullname", ""))\n+ )\n+ return users\n+\n def _get_users(self):\n results = {user["userid"] for user in self.acl_users.searchUsers()}\n- return [self.portal_membership.getMemberById(userid) for userid in results]\n+ users = [self.portal_membership.getMemberById(userid) for userid in results]\n+ return self._sort_users(users)\n \n def _get_filtered_users(self, query, limit):\n results = self.acl_users.searchUsers(id=query, max_results=limit)\n- return [\n+ users = [\n self.portal_membership.getMemberById(user["userid"]) for user in results\n ]\n+ return self._sort_users(users)\n \n def has_permission_to_query(self):\n sm = getSecurityManager()\n' +b"diff --git a/Products/CMFPlone/MigrationTool.py b/Products/CMFPlone/MigrationTool.py\nindex 456f1d9998..9dca5b740c 100644\n--- a/Products/CMFPlone/MigrationTool.py\n+++ b/Products/CMFPlone/MigrationTool.py\n@@ -102,7 +102,7 @@ def upgrade_all(self, context):\n Addon(profile_id='plone.app.discussion:default'),\n Addon(profile_id='plone.app.event:default'),\n Addon(\n- profile_id='plone.app.iterate:plone.app.iterate',\n+ profile_id='plone.app.iterate:default',\n check_module='plone.app.iterate'\n ),\n Addon(profile_id='plone.app.multilingual:default'),\n" -Repository: plone.restapi +Repository: Products.CMFPlone Branch: refs/heads/master -Date: 2021-09-13T21:25:13+02:00 -Author: Érico Andrei (ericof) -Commit: https://github.com/plone/plone.restapi/commit/3956dde1bad69a4bf27e89852e47fdd196eebb1a +Date: 2021-09-14T09:09:43+02:00 +Author: Jens W. Klein (jensens) +Commit: https://github.com/plone/Products.CMFPlone/commit/3227b15ce36f191d573b4accb90afb0b32493581 -Merge pull request #1223 from plone/users-ordering-fix +Merge pull request #3311 from plone/maurits/plone-app-caching-in-addon-list -Order users by fullname. +Add plone.app.caching to list of add-ons to upgrade Files changed: -A news/1222.bugfix -M src/plone/restapi/services/users/get.py +A news/82.bugfix +M Products/CMFPlone/MigrationTool.py -b'diff --git a/news/1222.bugfix b/news/1222.bugfix\nnew file mode 100644\nindex 000000000..1652f94f9\n--- /dev/null\n+++ b/news/1222.bugfix\n@@ -0,0 +1,2 @@\n+Fix @users endpoint to return list of users ordered by fullname property\n+[ericof]\n\\ No newline at end of file\ndiff --git a/src/plone/restapi/services/users/get.py b/src/plone/restapi/services/users/get.py\nindex cf29d5c9f..72d690731 100644\n--- a/src/plone/restapi/services/users/get.py\n+++ b/src/plone/restapi/services/users/get.py\n@@ -2,6 +2,7 @@\n from plone.restapi.interfaces import ISerializeToJson\n from plone.restapi.services import Service\n from Products.CMFCore.utils import getToolByName\n+from Products.CMFPlone.utils import normalizeString\n from zExceptions import BadRequest\n from zope.component import queryMultiAdapter\n from zope.component.hooks import getSite\n@@ -36,15 +37,25 @@ def _get_user_id(self):\n def _get_user(self, user_id):\n return self.portal_membership.getMemberById(user_id)\n \n+ @staticmethod\n+ def _sort_users(users):\n+ users.sort(\n+ key=lambda x: x is not None\n+ and normalizeString(x.getProperty("fullname", ""))\n+ )\n+ return users\n+\n def _get_users(self):\n results = {user["userid"] for user in self.acl_users.searchUsers()}\n- return [self.portal_membership.getMemberById(userid) for userid in results]\n+ users = [self.portal_membership.getMemberById(userid) for userid in results]\n+ return self._sort_users(users)\n \n def _get_filtered_users(self, query, limit):\n results = self.acl_users.searchUsers(id=query, max_results=limit)\n- return [\n+ users = [\n self.portal_membership.getMemberById(user["userid"]) for user in results\n ]\n+ return self._sort_users(users)\n \n def has_permission_to_query(self):\n sm = getSecurityManager()\n' +b"diff --git a/Products/CMFPlone/MigrationTool.py b/Products/CMFPlone/MigrationTool.py\nindex a7bf17b886..9dca5b740c 100644\n--- a/Products/CMFPlone/MigrationTool.py\n+++ b/Products/CMFPlone/MigrationTool.py\n@@ -85,14 +85,26 @@ def upgrade_all(self, context):\n # List of upgradeable packages. Obvious items to add here, are all\n # core packages that actually have upgrade steps.\n # Good start is portal_setup.listProfilesWithUpgrades()\n+# Please use 'check_module' for packages that are not direct dependencies\n+# of Products.CMFPlone, but of the Plone package.\n ADDON_LIST = AddonList([\n Addon(profile_id='Products.CMFEditions:CMFEditions'),\n- Addon(profile_id='Products.CMFPlacefulWorkflow:CMFPlacefulWorkflow'),\n+ Addon(\n+ profile_id='Products.CMFPlacefulWorkflow:CMFPlacefulWorkflow',\n+ check_module='Products.CMFPlacefulWorkflow'\n+ ),\n+ Addon(\n+ profile_id='plone.app.caching:default',\n+ check_module='plone.app.caching'\n+ ),\n Addon(profile_id='plone.app.contenttypes:default'),\n Addon(profile_id='plone.app.dexterity:default'),\n Addon(profile_id='plone.app.discussion:default'),\n Addon(profile_id='plone.app.event:default'),\n- Addon(profile_id='plone.app.iterate:plone.app.iterate'),\n+ Addon(\n+ profile_id='plone.app.iterate:default',\n+ check_module='plone.app.iterate'\n+ ),\n Addon(profile_id='plone.app.multilingual:default'),\n Addon(profile_id='plone.app.querystring:default'),\n Addon(profile_id='plone.app.theming:default'),\ndiff --git a/news/82.bugfix b/news/82.bugfix\nnew file mode 100644\nindex 0000000000..53ab366c9b\n--- /dev/null\n+++ b/news/82.bugfix\n@@ -0,0 +1,2 @@\n+Add ``plone.app.caching`` to the list of add-ons that is upgraded when upgrading Plone.\n+[maurits]\n"