diff --git a/product/ERP5Type/Core/Folder.py b/product/ERP5Type/Core/Folder.py index 92692ec473ee84c87a41d7876a8dc226e085f1ba..8a60e6796ca6caa1fd333b0b98612c54f31d7107 100644 --- a/product/ERP5Type/Core/Folder.py +++ b/product/ERP5Type/Core/Folder.py @@ -35,6 +35,7 @@ import ExtensionClass from Products.CMFCore.utils import _getAuthenticatedUser from Products.CMFCore.CMFCatalogAware import CMFCatalogAware +from Products.CMFCore.PortalFolder import ContentFilter from Products.ERP5Type.Base import Base from Products.ERP5Type.CopySupport import CopyContainer @@ -1433,24 +1434,21 @@ class Folder(CopyContainer, CMFBTreeFolder, CMFHBTreeFolder, Base, FolderMixIn, security.declareProtected( Permissions.AccessContentsInformation, 'contentValues' ) - def contentValues(self, spec=None, meta_type=None, portal_type=None, - sort_on=None, sort_order=None, checked_permission=None, **kw): + def contentValues(self, *args, **kw): # Returns a list of documents contained in this folder. # ( no docstring to prevent publishing ) - if meta_type is not None: - spec = meta_type - if portal_type is not None: - kw['portal_type'] = portal_type - filter = kw.pop('filter', {}) or {} - kw.update(filter) - if self._folder_handler == HBTREE_HANDLER: - object_list = CMFHBTreeFolder.contentValues(self, spec=spec, filter=kw) - else: - object_list = CMFBTreeFolder.contentValues(self, spec=spec, filter=kw) - if checked_permission is not None: - checkPermission = getSecurityManager().checkPermission - object_list = [o for o in object_list if checkPermission(checked_permission, o)] - object_list = sortValueList(object_list, sort_on, sort_order, **kw) + filter_kw = kw.pop('filter', None) or {} + portal_type_id_list = self._getTypesTool().objectIds() + if 'portal_type' in filter_kw: + portal_type = filter_kw.pop('portal_type') + if isinstance(portal_type, str): + portal_type = portal_type, + kw['portal_type'] = [x for x in portal_type if x in portal_type_id_list] + elif 'portal_type' not in kw: + kw['portal_type'] = portal_type_id_list + object_list = self.objectValues(*args, **kw) + if filter_kw: + object_list = filter(ContentFilter(**filter_kw), object_list) return object_list # Override security declaration of CMFCore/PortalFolder (used by CMFBTreeFolder)