Commit bb780bcf authored by Jérome Perrin's avatar Jérome Perrin

if some portal_type are passed to contentValues, don't filter this list of

portal_type to remove non existing types


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@35537 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 57aa5e73
...@@ -1431,17 +1431,16 @@ class Folder(CopyContainer, CMFBTreeFolder, CMFHBTreeFolder, Base, FolderMixIn, ...@@ -1431,17 +1431,16 @@ class Folder(CopyContainer, CMFBTreeFolder, CMFHBTreeFolder, Base, FolderMixIn,
def contentValues(self, *args, **kw): def contentValues(self, *args, **kw):
# Returns a list of documents contained in this folder. # Returns a list of documents contained in this folder.
# ( no docstring to prevent publishing ) # ( no docstring to prevent publishing )
portal_type_id_list = self._getTypesTool().listContentTypes()
filter_kw = kw.pop('filter', None) or {} filter_kw = kw.pop('filter', None) or {}
portal_type = kw.pop('portal_type', None) portal_type = kw.pop('portal_type', None)
if 'portal_type' in filter_kw: if 'portal_type' in filter_kw:
portal_type = filter_kw.pop('portal_type') portal_type = filter_kw.pop('portal_type')
if portal_type is None: if portal_type is None:
kw['portal_type'] = portal_type_id_list kw['portal_type'] = self._getTypesTool().listContentTypes()
else: else:
if isinstance(portal_type, str): if isinstance(portal_type, str):
portal_type = portal_type, portal_type = portal_type,
kw['portal_type'] = [x for x in portal_type if x in portal_type_id_list] kw['portal_type'] = portal_type
object_list = self.objectValues(*args, **kw) object_list = self.objectValues(*args, **kw)
if filter_kw: if filter_kw:
object_list = filter(ContentFilter(**filter_kw), object_list) object_list = filter(ContentFilter(**filter_kw), object_list)
......
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