summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNicolas Demonte <nicolas@affinitic.be>2021-02-11 14:12:37 (GMT)
committerNicolas Demonte <nicolas@affinitic.be>2021-02-11 17:43:22 (GMT)
commit36f13e5561254fe839f403059dfc382297b72951 (patch)
tree7ec8a8ba88491917d759bab9c4aa28e65e1b1229
parentf47560ca3e33b3ba1147f6ffa0800bd29de89996 (diff)
downloadpfwbged.folder-master.zip
pfwbged.folder-master.tar.gz
pfwbged.folder-master.tar.bz2
Directly use objects in classifying folder portlet #50783HEADmaster
-rw-r--r--src/pfwbged/folder/folder.py15
1 files changed, 5 insertions, 10 deletions
diff --git a/src/pfwbged/folder/folder.py b/src/pfwbged/folder/folder.py
index 0cbad53..a843a03 100644
--- a/src/pfwbged/folder/folder.py
+++ b/src/pfwbged/folder/folder.py
@@ -113,7 +113,7 @@ class Folder(Container):
l.extend(parent.parent_folders_intid_tree(limit=limit-1))
return l
- def child_folders_brains(self):
+ def child_folders_objects(self):
from .link import ILink
intids = component.getUtility(IIntIds)
intid_catalog = component.getUtility(ICatalog)
@@ -122,8 +122,7 @@ class Folder(Container):
except KeyError:
return []
- children = []
- uuids = []
+ folders = []
sm = getSecurityManager()
for item in intid_catalog.findRelations({
'to_id': intid,
@@ -137,16 +136,12 @@ class Folder(Container):
document = aq_parent(link)
if IFolder.providedBy(document):
- uuids.append(IUUID(document))
+ folders.append(document)
- portal_catalog = api.portal.get_tool('portal_catalog')
- return portal_catalog.searchResults({'UID': uuids}, sort_on='sortable_title')
+ return sorted(folders, key=lambda x: x.Title().lower().strip())
def child_folders(self):
- return [IContentListingObject(x) for x in self.child_folders_brains()]
-
- def child_folders_objects(self):
- return [x.getObject() for x in self.child_folders_brains()]
+ return [IContentListingObject(x) for x in self.child_folders_objects()]
def intid(self):
intids = component.getUtility(IIntIds)