Fix Folder.contentValues for CMF 2.2 compatibility (they no longer accept...

Fix Folder.contentValues for CMF 2.2 compatibility (they no longer accept 'spec' parameter) plus performance work by jm (approved by jm)

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@29873 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 952133c9
...@@ -35,6 +35,7 @@ import ExtensionClass ...@@ -35,6 +35,7 @@ import ExtensionClass
from Products.CMFCore.utils import _getAuthenticatedUser from Products.CMFCore.utils import _getAuthenticatedUser
from Products.CMFCore.CMFCatalogAware import CMFCatalogAware from Products.CMFCore.CMFCatalogAware import CMFCatalogAware
from Products.CMFCore.PortalFolder import ContentFilter
from Products.ERP5Type.Base import Base from Products.ERP5Type.Base import Base
from Products.ERP5Type.CopySupport import CopyContainer from Products.ERP5Type.CopySupport import CopyContainer
...@@ -1433,24 +1434,17 @@ class Folder(CopyContainer, CMFBTreeFolder, CMFHBTreeFolder, Base, FolderMixIn, ...@@ -1433,24 +1434,17 @@ class Folder(CopyContainer, CMFBTreeFolder, CMFHBTreeFolder, Base, FolderMixIn,
security.declareProtected( Permissions.AccessContentsInformation, security.declareProtected( Permissions.AccessContentsInformation,
'contentValues' ) 'contentValues' )
def contentValues(self, spec=None, meta_type=None, portal_type=None, def contentValues(self, *args, **kw):
sort_on=None, sort_order=None, checked_permission=None, **kw): filter_kw = kw.pop('filter', None) or {}
# Returns a list of documents contained in this folder. portal_type_id_list = self._getTypesTool().objectIds()
# ( no docstring to prevent publishing ) if 'portal_type' in filter_kw:
if meta_type is not None: kw['portal_type'] = [x for x in filter_kw.pop('portal_type')
spec = meta_type if x in portal_type_id_list]
if portal_type is not None: elif 'portal_type' not in kw:
kw['portal_type'] = portal_type kw['portal_type'] = portal_type_id_list
filter = kw.pop('filter', {}) or {} object_list = self.objectValues(*args, **kw)
kw.update(filter) if filter_kw:
if self._folder_handler == HBTREE_HANDLER: object_list = filter(ContentFilter(**filter_kw), object_list)
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)
return object_list return object_list
# Override security declaration of CMFCore/PortalFolder (used by CMFBTreeFolder) # Override security declaration of CMFCore/PortalFolder (used by CMFBTreeFolder)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment