Commit bb39e693 authored by Jean-Paul Smets's avatar Jean-Paul Smets

Added support for filtering in contentValues

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@7120 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 93f6e43a
......@@ -737,6 +737,24 @@ 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):
"""
Returns a list containing object contained in this folder.
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)
object_list = sortValueList(object_list, sort_on, sort_order, **kw)
return object_list
# Override security declaration of CMFCore/PortalFolder (used by CMFBTreeFolder)
security.declareProtected(Permissions.ModifyPortalContent,'setDescription')
security.declareProtected( Permissions.ModifyPortalContent, 'setTitle' )
......
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