From a3d920bbc94f1f525230ed42941177ae2754ea8e Mon Sep 17 00:00:00 2001 From: "Jens W. Klein" Date: Thu, 25 Nov 2021 01:10:27 +0100 Subject: [PATCH 1/2] fix #3323 --- Products/CMFPlone/Portal.py | 18 ++++++++++++++++++ news/3323.bugifx | 2 ++ 2 files changed, 20 insertions(+) create mode 100644 news/3323.bugifx diff --git a/Products/CMFPlone/Portal.py b/Products/CMFPlone/Portal.py index 0474b4f6ca..4c49cce3a1 100644 --- a/Products/CMFPlone/Portal.py +++ b/Products/CMFPlone/Portal.py @@ -139,6 +139,24 @@ def __before_publishing_traverse__(self, arg1, arg2=None): super(PloneSite, self).__before_publishing_traverse__(arg1, arg2) + # Partly from OFS.OrderSupport + @security.protected(permissions.AccessContentsInformation) + def tpValues(self): + # Return a list of subobjects, used by ZMI tree tag (and only there). + # see also https://github.com/plone/Products.CMFPlone/issues/3323 + result = [] + obj_ids = self.objectIds() + obj_ids.sort() + getOb = self._getOb + for id in obj_ids: + obj = getOb(id) + if ( + hasattr(aq_base(obj), 'isPrincipiaFolderish') + and obj.isPrincipiaFolderish + ): + result.append(obj) + return result + def __browser_default__(self, request): """ Set default so we can return whatever we want instead of index_html """ diff --git a/news/3323.bugifx b/news/3323.bugifx new file mode 100644 index 0000000000..957a8924b3 --- /dev/null +++ b/news/3323.bugifx @@ -0,0 +1,2 @@ +Fix #3323DX-Site-Root: ZMI Nav-Tree is no longer expandable. +[jensens] \ No newline at end of file From c8d8805b18f7974bd6129c9a717f6680bc6fac0e Mon Sep 17 00:00:00 2001 From: "Jens W. Klein" Date: Thu, 25 Nov 2021 13:26:14 +0100 Subject: [PATCH 2/2] optimization suggested by @ale-rt --- Products/CMFPlone/Portal.py | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/Products/CMFPlone/Portal.py b/Products/CMFPlone/Portal.py index d668f40b5a..024a9e49cf 100644 --- a/Products/CMFPlone/Portal.py +++ b/Products/CMFPlone/Portal.py @@ -137,23 +137,15 @@ def __before_publishing_traverse__(self, arg1, arg2=None): super(PloneSite, self).__before_publishing_traverse__(arg1, arg2) - # Partly from OFS.OrderSupport + # Concept from OFS.OrderSupport @security.protected(permissions.AccessContentsInformation) def tpValues(self): # Return a list of subobjects, used by ZMI tree tag (and only there). # see also https://github.com/plone/Products.CMFPlone/issues/3323 - result = [] - obj_ids = self.objectIds() - obj_ids.sort() - getOb = self._getOb - for id in obj_ids: - obj = getOb(id) - if ( - hasattr(aq_base(obj), 'isPrincipiaFolderish') - and obj.isPrincipiaFolderish - ): - result.append(obj) - return result + return sorted( + (obj for obj in self.objectValues() if getattr(aq_base(obj), 'isPrincipiaFolderish', False)), + key=lambda obj: obj.getId(), + ) def __browser_default__(self, request): """ Set default so we can return whatever we want instead