From f81311858a036fcc48208d7d6d9d1bd5a4dc2c5c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=A9rome=20Perrin?= <jerome@nexedi.com>
Date: Wed, 10 May 2006 11:52:59 +0000
Subject: [PATCH] Honor 'filter' keyword argument in contentValues, for
 compatibility with PortalFolder.contentValues Don't filter by portal type,
 it's done by PortalFolder.contentValues

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@7145 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 product/ERP5Type/Document/Folder.py | 24 ++++++++++++------------
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/product/ERP5Type/Document/Folder.py b/product/ERP5Type/Document/Folder.py
index 8becb6a2ff..2c9b77174d 100644
--- a/product/ERP5Type/Document/Folder.py
+++ b/product/ERP5Type/Document/Folder.py
@@ -721,12 +721,13 @@ be a problem)."""
         parent.manage_delObjects(from_object.getId())
     return corrected_list
 
-  security.declareProtected( Permissions.AccessContentsInformation, 'objectValues' )
-  def objectValues(self, spec=None, meta_type=None, portal_type=None, sort_on=None, sort_order=None, **kw):
+  security.declareProtected( Permissions.AccessContentsInformation,
+                             'objectValues' )
+  def objectValues(self, spec=None, meta_type=None, portal_type=None,
+                   sort_on=None, sort_order=None, **kw):
     """
     Returns a list containing object contained in this folder.
     """
-    #LOG('objectValues', 0, 'spec = %r, kw = %r' % (spec, kw))
     if meta_type is not None:
       spec = meta_type
     object_list = CMFBTreeFolder.objectValues(self, spec=spec)
@@ -737,21 +738,20 @@ be a problem)."""
     object_list = sortValueList(object_list, sort_on, sort_order, **kw)
     return object_list
 
-  security.declareProtected( Permissions.AccessContentsInformation, 'contentValues' )
-  def contentValues(self, spec=None, meta_type=None, portal_type=None, sort_on=None, sort_order=None, **kw):
+  security.declareProtected( Permissions.AccessContentsInformation,
+                             'contentValues' )
+  def contentValues(self, spec=None, meta_type=None, portal_type=None,
+                    sort_on=None, sort_order=None, **kw):
     """
     Returns a list containing object contained in this folder.
-    Filter objects with appropriate permissions (as in contentValues
+    Filter objects with appropriate permissions (as in contentValues)
     """
-    #LOG('contentValues', 0, 'spec = %r, kw = %r' % (spec, kw))
     if meta_type is not None:
       spec = meta_type
-    if portal_type is not None: kw['portal_type'] = portal_type
-    object_list = CMFBTreeFolder.contentValues(self, spec=spec, filter = kw)
     if portal_type is not None:
-      if type(portal_type) == type(''):
-        portal_type = (portal_type,)
-      object_list = filter(lambda x: x.getPortalType() in portal_type, object_list)
+      kw['portal_type'] = portal_type
+    kw.update(kw.get('filter', {}))
+    object_list = CMFBTreeFolder.contentValues(self, spec=spec, filter=kw)
     object_list = sortValueList(object_list, sort_on, sort_order, **kw)
     return object_list
 
-- 
2.30.9