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

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
parent 1d3764c5
...@@ -721,12 +721,13 @@ be a problem).""" ...@@ -721,12 +721,13 @@ be a problem)."""
parent.manage_delObjects(from_object.getId()) parent.manage_delObjects(from_object.getId())
return corrected_list return corrected_list
security.declareProtected( Permissions.AccessContentsInformation, 'objectValues' ) security.declareProtected( Permissions.AccessContentsInformation,
def objectValues(self, spec=None, meta_type=None, portal_type=None, sort_on=None, sort_order=None, **kw): '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. Returns a list containing object contained in this folder.
""" """
#LOG('objectValues', 0, 'spec = %r, kw = %r' % (spec, kw))
if meta_type is not None: if meta_type is not None:
spec = meta_type spec = meta_type
object_list = CMFBTreeFolder.objectValues(self, spec=spec) object_list = CMFBTreeFolder.objectValues(self, spec=spec)
...@@ -737,21 +738,20 @@ be a problem).""" ...@@ -737,21 +738,20 @@ be a problem)."""
object_list = sortValueList(object_list, sort_on, sort_order, **kw) object_list = sortValueList(object_list, sort_on, sort_order, **kw)
return object_list return object_list
security.declareProtected( Permissions.AccessContentsInformation, 'contentValues' ) security.declareProtected( Permissions.AccessContentsInformation,
def contentValues(self, spec=None, meta_type=None, portal_type=None, sort_on=None, sort_order=None, **kw): '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. 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: if meta_type is not None:
spec = meta_type 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 portal_type is not None:
if type(portal_type) == type(''): kw['portal_type'] = portal_type
portal_type = (portal_type,) kw.update(kw.get('filter', {}))
object_list = filter(lambda x: x.getPortalType() in portal_type, object_list) object_list = CMFBTreeFolder.contentValues(self, spec=spec, filter=kw)
object_list = sortValueList(object_list, sort_on, sort_order, **kw) object_list = sortValueList(object_list, sort_on, sort_order, **kw)
return object_list return 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