Commit 47cd7464 authored by Julien Muchembled's avatar Julien Muchembled

Always filter the list of portal types (fix contentValues(portal_type=...))

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