Back to index

plone3  3.1.7
getObjectsFromPathList.py
Go to the documentation of this file.
00001 ## Script (Python) "getObjectsFromPathList"
00002 ##bind container=container
00003 ##bind context=context
00004 ##bind namespace=
00005 ##bind script=script
00006 ##bind subpath=traverse_subpath
00007 ##parameters=paths=[],batch=False,b_size=100
00008 ##title=method to turn a list of paths into a list of objects
00009 ##
00010 contents = []
00011 portal = context.portal_url.getPortalObject()
00012 for path in paths:
00013     obj = portal.restrictedTraverse(path, None)
00014     if obj is not None: contents.append(obj)
00015 
00016 if batch:
00017     from Products.CMFPlone import Batch
00018     b_start = context.REQUEST.get('b_start', 0)
00019     batch = Batch(contents, b_size, int(b_start), orphan=0)
00020     return batch
00021 
00022 return contents